Mozilla Support में खोजें

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Cannot upload large files. Trying to upload a file 415MB. Firefox crashes and interface DOM angular not updating display. Using var xhr = new XMLHttpRequest(

  • कोई प्रतियुत्तर नहीं
  • 1 यह समस्या है
  • 1 view
more options

Trying to post a large file 400MB to server.

var url = "api/fileupload";

       var xhr = new XMLHttpRequest();
       xhr.addEventListener('progress', function (e) {
           var done = e.position || e.loaded, total = e.totalSize || e.total;
           console.log('xhr progress: ' + (Math.floor(done / total * 1000) / 10) + '%');
       }, false);
       if (xhr.upload) {
           xhr.upload.onprogress = function (e) {
               // Event listener for when the file is uploading
               $scope.$apply(function () {
                   var percentCompleted;
                   if (e.lengthComputable) {
                       percentCompleted = Math.round(e.loaded / e.total * 100);
                       importFile.Progress = percentCompleted;
                       if (percentCompleted < 1) {
                           importFile.MessageID = 1; // Uploading
                       } else if (percentCompleted == 100) {
                           importFile.MessageID = 2; // Saving
                       } else {
                           importFile.StatussName = percentCompleted + '%';
                       }
                   }
                   console.log(e);
               });
           };
       }
       xhr.onreadystatechange = function (e) {
           if (4 == this.readyState && this.status == 200) {
               $scope.$apply(function () {
                   importFile.MessageID = 3; // Finished
                   $scope.UploadInProgress = false;
                   deferred.resolve("Finished");
                   console.log('MessageChanged: ' + importFile.MessageID);
               });
           } else if (4 == this.readyState) {
               $scope.$apply(function () {
                   importFile.MessageID = 4; // FileUpload Failed
                   importFile.HasFailedUpload = true;
                   $scope.UploadInProgress = false;
                   console.log('Message Failed: ' + importFile.MessageID);
                   deferred.reject("error");
               });
           }
       };


       xhr.open('post', url, true);
       var formData = new FormData();
       formData.append('key', key);
       formData.append('productlineid', productlineid);
       formData.append("filename", importFile.File);
       xhr.send(formData);

Firebug doesn't show "console.log()" messages.

After 4 minutes, I get the following from FireBug:

Message Failed: 4

Chrome works just fine using the same code.

Thanks, Stuart

Trying to post a large file 400MB to server. var url = "api/fileupload"; var xhr = new XMLHttpRequest(); xhr.addEventListener('progress', function (e) { var done = e.position || e.loaded, total = e.totalSize || e.total; console.log('xhr progress: ' + (Math.floor(done / total * 1000) / 10) + '%'); }, false); if (xhr.upload) { xhr.upload.onprogress = function (e) { // Event listener for when the file is uploading $scope.$apply(function () { var percentCompleted; if (e.lengthComputable) { percentCompleted = Math.round(e.loaded / e.total * 100); importFile.Progress = percentCompleted; if (percentCompleted < 1) { importFile.MessageID = 1; // Uploading } else if (percentCompleted == 100) { importFile.MessageID = 2; // Saving } else { importFile.StatussName = percentCompleted + '%'; } } console.log(e); }); }; } xhr.onreadystatechange = function (e) { if (4 == this.readyState && this.status == 200) { $scope.$apply(function () { importFile.MessageID = 3; // Finished $scope.UploadInProgress = false; deferred.resolve("Finished"); console.log('MessageChanged: ' + importFile.MessageID); }); } else if (4 == this.readyState) { $scope.$apply(function () { importFile.MessageID = 4; // FileUpload Failed importFile.HasFailedUpload = true; $scope.UploadInProgress = false; console.log('Message Failed: ' + importFile.MessageID); deferred.reject("error"); }); } }; xhr.open('post', url, true); var formData = new FormData(); formData.append('key', key); formData.append('productlineid', productlineid); formData.append("filename", importFile.File); xhr.send(formData); Firebug doesn't show "console.log()" messages. After 4 minutes, I get the following from FireBug: Message Failed: 4 Chrome works just fine using the same code. Thanks, Stuart