Add warning before navigating away during upload

It would be very helpful to add a warning before users navigate away from the upload page. Navigating away from the page could cause problems if the upload is already in progress.

Something like the following might work:

window.onbeforeunload = function() {
    return "An upload may be in progress, are you sure you want to leave?";
}