$.Ajax ({
Url:basepath +"/container" +"/upload" +"? _t=" +New Date ().GetTime (),
DataType:' JSON ',
Data:form,
Type:' POST ',
ProcessData:False,//TellJqueryDo not process the sent data
ContentType:False,
Xhr:function () {
MYXHR =$.Ajaxsettings.XHR ();
IfMyxhr.Upload) {
Myxhr.Upload.AddEventListener (' Progress ',Function (e) {
if (e.lengthcomputable) {
var percent = Math.Floor (E.loaded/e.total*100);
If (Percent <=100) {
$ ("#J_progress_bar"). Progress (' Set progress ', percent);
$ ("#J_progress_label"). HTML ('Uploaded:' +percent+ '% ');
Console.Log (percent)
}
If (Percent >=100) {
$ ("#J_progress_label"). HTML ('File upload complete, please wait...‘);
$ ("#J_progress_label"). AddClass (' success ');
Console.Log (percent)
}
}
},False;
}
ReturnMyxhr;
},
Success: function (res) {
// request succeeded
},
Error: function (res) {
// request failed
Console. log (res);
}
})
Display the progress of the upload, the data parameter for the specific use of formdata formdata can self-query data
Welcome Dabigatran Exchange: 589780530
File Upload display progress (JS code implementation, not suitable for multiple relay display)