Jump to content

UPU file upload


opencombatclan

Recommended Posts

Hello everyone.

 

For a long time I have been searching for a working php / javascript file upload progress bar.

(working without flash or perl or php extensions).

 

I recently found a project which is exactly doing that:

http://sourceforge.net/projects/upu/

(It is showing a accurate progress bar while uploading).

 

However, I want to understand how this works.

It makes a socket and listens to it, or smth like that.

 

Can anyone tell me how this script generates the progress bar?

Link to comment
https://forums.phpfreaks.com/topic/188466-upu-file-upload/
Share on other sites

Too bad the author did not publish any information or host a forum on the sourceforge site. Have you checked his direct site, which unfortunately is not in English.

 

Short version of what it is doing -

 

The script uses AJAX in the browser to submit to an iframe. This allows the status to be fetched from the server and updated on the page while the upload is in progress. This is pretty standard for doing things like displaying an upload 'activity' (not to be confused with upload progress) indicator and for displaying upload error messages.

 

What the code is doing differently that allows the upload progress to work, is it starts a php script that opens a socket connection that listens on a specific (randomly picked) port number. There is also a process id number assigned. The port number and process id are passed back to the javascript running in the browser. The browser submits the form data to the correct port number so that the php script is actually used to receive and process the uploaded data.

 

The javascript code that gets and displays the progress is again using AJAX and periodically makes http requests to the getinfo.php page, providing the specific process id on the end of the URL. This page uses the specific process id to get information about the matching file being uploaded and returns that information to the browser where it can be displayed.

 

Do you have a more specific question that was not answered already?

Link to comment
https://forums.phpfreaks.com/topic/188466-upu-file-upload/#findComment-995030
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.