Saturday 30 June 2018

How to skip or remove some file at run time from uploading list

I'm using blueimp plugin https://github.com/blueimp/jQuery-File-Upload/wiki/API

I need to remove some files, during run time, from the queue.

When status code 17 (File Already Exits) from the server, then that particular file should be removed.

This is what I have tried so far to no success.

  $('#fileupload').fileupload({
         url: 'url.php',
         maxChunkSize: 65536, // 120 KB,
         maxRetries: 10,
         dataType: 'json',
         multipart: false,
        sequentialUploads: true,

             add:function(){........},

            done:function(){........}

    }).on('fileuploadchunkdone', function (e, data) {

       if(data.result.status == 17){
            var currentFileObject = data.files[0];
            var index = data.originalFiles.indexOf(currentFileObject); // find index in originalFiles
            data.originalFiles.splice(0,index);
            //data.files.length = 0; // if i uncomment this line some error will come, like undefined fileName
            data.submit();
        }
     });

I am removing the file by finding in data.originalFiles

NOTE:(please note) i'm not using any ui (cancel, update, cropimage, thumbnail) etc

Please help me to solve this problem.

Thanks in advance !!!!!!!!!!!



from How to skip or remove some file at run time from uploading list

No comments:

Post a Comment