Home  |  About  | Last |  Submit  |  Contact
AllQuests.com

Previous Question:  Javascript Getting invalid Time Zone  Scripting Client SideNext Question:  How to copy text to clipboard  Scripting Client Side
Question AJAX Upload Progress ( CodeGuru Forums Scripting Client Side )
Updated: 2008-08-12 06:08:53 (1)
AJAX Upload Progress

I'm currently in the process of re-writing an old CMS by updating alot of the work to AJAX to speed everything up (and, finally, the drag-drop is actually useable, rather than painfully slow). However, I'm currently stuck on what to do with image uploads. Because I have no access to my hosting configuration (I'm using free hosting for everything :blush, I can't use any of the progress indicators that I've found online for AJAX uploads.

The actual upload is performed, in the old version, using the PHP $_FILES.

So: questions:
1) Is there a simple way to get the progress of a XMLHTTP Request?
2) Is there a simple way to transfer the file in the PHP script in blocks, and echo after each block completion
3) Can you make another suggestion for a pure JS/AJAX/PHP solution. I don't need fancy scrollbars, just a percentage...




Answers: AJAX Upload Progress ( CodeGuru Forums Scripting Client Side )
AJAX Upload Progress

Quote:
Originally Posted by javajawa
1) Is there a simple way to get the progress of a XMLHTTP Request?

Status yes, but progress no. To do this would require a re-write of the whole protocol so that the client and server would talk during the passing of information. This would cause it to slow down and defeat its purpose of making a faster connection. Hence, I don't see this happening soon.

Quote:
Originally Posted by javajawa
2) Is there a simple way to transfer the file in the PHP script in blocks, and echo after each block completion

Not through the browser. This requires a file type input which sends the whole chunk. There are Java and Flash implementations you could use which do this.

Quote:
Originally Posted by javajawa
3) Can you make another suggestion for a pure JS/AJAX/PHP solution. I don't need fancy scrollbars, just a percentage...

In theory...Since PHP creates a temp file for any $_FILES array item, could you not just send an AJAX request every 10 milliseconds and check the size of that temporary file? Then compare it with $_FILES['file']['size'].



Previous Question:  Javascript Getting invalid Time Zone  CodeGuru Forums  Scripting Client SideNext Question:  How to copy text to clipboard  CodeGuru Forums  Scripting Client Side

- Source: AJAX Upload Progress CodeGuru Forums Scripting Client Side
- Previous Question: Javascript Getting invalid Time Zone CodeGuru Forums Scripting Client Side
- Next Question: How to copy text to clipboard CodeGuru Forums Scripting Client Side





AllQuests.com


Best dedicated servers   Top dedicated servers   Cheap dedicated servers   Linux dedicated servers   Windows dedicated servers   Unmetered dedicated servers