سؤال

I am wondering how to get the progress of a file upload using XMLHTTPRequest. In Firefox the onprogress method does not fire at all, and in chrome it only fires after the file has finished uploading.

function fileUpload(file)
{
    var formData = new FormData();
    formData.append('file', file);

    var xhr = new XMLHttpRequest();
    xhr.onprogress = function(e)
    {
        alert('progress');
    };

    xhr.open('POST', 'post.php', true);

    xhr.send(formData);  // multipart/form-data
}

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top