I have found some scripts that help me at this process but I got some problems.
Script is like below:
var data = new FormData();
//item is file which is needed to upload
  data.append('file',item);
  data.append('param1',variable);
  $.ajax({
  xhr: function() {
    var xhr = $.ajaxSettings.xhr();
    if(xhr.upload){
        xhr.upload.addEventListener("progress", function(e) {
          if (e.lengthComputable) {
            var percentComplete = e.loaded / e.total;
            percentComplete = parseInt(percentComplete * 100);
            console.log(percentComplete);
          }
    }, false);
}
return xhr;
 },
url:url,
  type: "POST",
  data:data,
  processData: false,
  contentType: false,
  success: function() {
  },
});
My problem is when I begin to upload it reach 100% suddenly (percentComplete became 100%) ,doesn't work and at the result user need to wait without percentages.Why it is not working properly,how can I solve it?And I have seen that when I open developer tab and network bar,then if I switch another option than No throttling, it begins to work.But normally it doesn't work
