Search code examples
javascriptjqueryjquery-file-upload

Processing Callback Options not working in jQuery File Upload


I'm using blueimp's jQuery File Upload and I'm trying to display what image is being uploaded at the moment (only the index, "Image 1 is being uploaded" for example).

I tried to use process to change a span element so it is displayed, but it did nothing. The option sequentialUploads is set to true.

I tried both

.bind('fileuploadprocess', function (e, data) {
  alert(data.index);
});

and

process:function(e,data){ alert(data.index); }

None of them worked. Tried others like processdone and processalways, but they did nothing also.

Thank you so much ❤


Solution

  • You can use:

    .on('fileuploaddone', function (e, data) {/* ... */})
    

    For successful upload requests (will also be called if the server returns a JSON response with an error property)

    Example:

    function (e, data) {
        // data.result
        // data.textStatus;
        // data.jqXHR;
    }
    

    *Read the official documentation