anacronw / multer-s3

multer storage engine for amazon s3
MIT License
660 stars 190 forks source link

Handling Large Files #69

Closed ravishan110 closed 3 years ago

ravishan110 commented 7 years ago

I am not able to upload large files using multer-s3. It is not giving me any error as well. It just doesn't upload the file, doesn't even enters the callback and gets timeout. Any way to handle uploading large files to s3 Bucket?

I am using it like this:

var uploadSingle = upload.single('uploadFile');

router.post('/uploadVideo',function(req,res,next){  
    uploadSingle(req,res,function(err){
                // doesn't come here if the file is large
            if(err){
                //Error Response , Error while uploading Module PDF;
            }
            else{
                //handling file upload
               // success response
            }
    });
}

It doesnt enters the callback of uploadSingle.

NachoCalcagno commented 7 years ago

+1 Hello, i'm having the same issue, i've tried files from 5mb and isn't working.

ParikshitChavan commented 6 years ago

+1 having the same issue. however, large files work on localhost..!

ravishan110 commented 6 years ago

I am just giving it a shot, but can you increase your server timeout value, and see if it works. I think it the upload is not working because the timeout happens even before the file is successfully uploaded .

If you are using nodejs, this line should do it.

server.timeout = timeInMilliseconds Eg. server.timeout = 10000; //10 seconds

ParikshitChavan commented 6 years ago

As it happens my problem was happening because of nginx client_max_body_size limit. I found it out by checking nginx error log of my server.

to fix this, just add something like this to your nginx setting.

client_max_body_size 20M

or whatever MB limit you want.