javascript - blueimp plugin uploads multiple files on each subsequent upload -
i trying use blueimp control upload single file (like normal html file upload). however, after file has finished uploading, select different file, previous file uploaded again new file. , subsequently multiple files keep getting uploaded (previously selected files) everytime after select file.
screenshots illustrate :
how solve problem ?
here javascript initialization code :
$().ready(function(){ $('#fileupload').fileupload({ datatype: 'json', maxchunksize:0, singlefileuploads: true, autoupload:false, progressall: function (e, data) { var progress = parseint(data.loaded / data.total * 100, 10); //console.log(); $('#progress .bar').css( 'width', progress + '%' ); }, add: function (e, data) { $("#start-sql-upload").on('click', function () { data.submit(); }); } });
});
and upload form :
<form> <input id="fileupload" type="file" name="files" data-url="http://localhost/database/upload"> <button type="button" class="btn btn-info btn-sm" id="start-sql-upload">upload file</button> </form>
please help.
i had same issue , i'm setting maxnumberoffiles option resolved issue. in:
maxnumberoffiles: 1
using code:
$('#fileupload').fileupload({ datatype: 'json', maxchunksize:0, singlefileuploads: true, autoupload:false, maxnumberoffiles: 1, progressall: function (e, data) { var progress = parseint(data.loaded / data.total * 100, 10); //console.log(); $('#progress .bar').css( 'width', progress + '%' ); }, add: function (e, data) { $("#start-sql-upload").on('click', function () { data.submit(); }); }
});
Comments
Post a Comment