jquery - Set and Get uniqueID for each file -
im use jqueryfileupload. how can uniqueid each file???
$('#multifileinput').fileupload({ dropzone: $("#dropzone"), url: "./fileupload.ashx", datatype: 'json', submit: function (e, data) { $.each(data.files, function (i, file) { alert("uid file " + file.name + " - " + file.uid); } } });
i had fix code in jquery-fileupload-5.42.3.js:
_getsinglefileinputfiles: function (fileinput) { /* ----==== code ====-----*/ if (!$.fileuploadid) $.fileuploadid = 1; $.each(files, function (index, file) { file.uid = "fileuploadid" + $.fileuploadid++ ; }); return $.deferred().resolve(files).promise(); }
can have access without code changes source jqueryfileupload?
var myincrement = 0; $('#multifileinput').fileupload({ dropzone: $("#dropzone"), url: "./fileupload.ashx", datatype: 'json', submit: function (e, data) { $.each(data.files, function (i, file) { file.uid = "myincrement" + ++myincrement; //registred uid each file alert("submit file " + file.name + " - " + file.uid); } }, done: function (e, data) { $.each(data.files, function (i, file) { alert("done file " + file.name + " - " + file.uid); //get uid each file } } });
Comments
Post a Comment