Question

Our web application currently is using uploadify(v2.1.4) to upload multiple files to our remote server. But when a user uploads a file, he can accidentally (or on purpose) navigate out of the upload page, and the upload will be stopped.

window.onbeforeunload = function(e) {
        if(curently_uploading())
          return 'There is ongoing upload, are you sure that you want to leave this page?';
        else
          return null;              
    }

It works, the user receives the notification.

But... the current file upload brakes (uploadify.js receives error: 2038).

If multiple files are uploaded, only the current file breaks, the others keep uploading afterwards.

I suspect that when the user tries to leave the upload page, all ongoing POST requests are suspended. Can I prevent that?

Or, am I supposed to add the file again in the upload queue?

EDIT: seems that this only breaks on certain browsers.

Was it helpful?

Solution

Hope this is of use to you.

window.onbeforeunload = confirmExit;
function confirmExit()
{
    return "Warning: Your file upload is in progress!!";
}

The plugin used for fileupload in this project is blueimp jquery File Upload

I've faced no upload breaking, can add the files later on in the queue. I can't really say about uploadify as i've not tried it. May be the documentation of uploadify can be a great help to you.

Please search with your error code.
http://www.uploadify.com/forums/discussion/556/another-one-on-io-error-2038/p1

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top