1

I want to provide facility to upload zip file with size more than 1 GB in my web application. I am using nodejs version 8.11.3 using Multer node module at server side. When testing this functionality locally, it works fine however when i host my application at any cloud server (Irrespective of cloud provider) it is not working results in unresponsive browser. Seems like there is an issue while uploading file through network. Tried via fiddler/postman request with no success.

Already followed solutions mentioned in links :

Tried sending file data in chunks resulted in many http requests ended in browser crash https://hpbn.co/xmlhttprequest/

Tried using websockets to send data (same result) https://github.com/rico345100/socket.io-file-client

Tried FTP approach http://ftp.apixml.net/

// server side code

let limits = {
        files: 1,
        fileSize: 5000 * 1024 * 1024
    }

uploads = multer({
            dest: "/uploads/",
            limits: limits,
            fileFilter: function(req, file, cb) {
                ...
            }
        });

// Client side code

var fd = new FormData();
fd.append("fileToUpload", blobFile);
  var xhr = new window.XMLHttpRequest();
    $.ajax({
                        url: `/upload`,
                        type: "POST",
                        data: fd,
                        processData: false,
                        contentType: false,
                        xhr: function() {
                        },
                        success: function(response) {
                        },
                        error: function(errorMsgResp) {
                        }
                    });

Expected result is file should get uploaded even if size is more than 1GB without any performance bottleneck.

0 Answers0