Question

Can anyone else confirm this, or am I doing something wrong?

In Firefox the XMLHttpRequest upload events load and loadend only fire once download has finished, not when upload has finished. Also the progress event doesn't get fired at the end of the upload.

See this example: http://geo.kitten-x.com/testupload.html

I believe that Chrome behaves correctly in that the progress bar goes all the way across to 100% and then the load and loadend events are fired, and then once the script ends the result is posted. In Firefox the load and loadend events only fire once the script has finished.

Was it helpful?

Solution

Apparently these events fire when the download starts instead of when the upload finishes. Which is a known issue, discussed here: https://bugzilla.mozilla.org/show_bug.cgi?id=637002

The Firefox devs argue that until the download starts there is no way to know that the upload has completed as it might still be buffered somewhere (and in some cases might have to be resent).

UPDATE

The solution is to have your second page start returning output as soon as possible, for example in PHP with:

ob_implicit_flush(true);
for ($i = 0; $i < ob_get_level(); $i++)
  ob_end_clean();
echo ' ';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top