1

I have used carrierwave for my users to upload files in my rails app. When a user uploads multiple files of size more than 400mb (approx.) they get a timeout error.

Note: I've hosted my app rails app on heroku.

fhaider
  • 165
  • 2
  • 11
  • That's because the temporary file is uploaded to heroku and then pushed to wherever you're storing it (like amazon). Also, which web server you're using makes a difference, and if you're doing image processing this also drags out the time it takes to 'get' and 'process' and 'push' each upload. To provide a solution though I'd need more information. Where are you storing hte images? Which web server are you using? Are you processing image files (for thumbnails, and sizes)? etc – trh Aug 30 '15 at 16:58
  • I'm not processing any image. I'm using CSS for displaying images as thumbnails. I'm using ftp of bluehost for file storage. – fhaider Aug 30 '15 at 17:06
  • 1
    Gotcha. You'll have to roll your own solution, but using js uploads will take heroku out of the equation will be your best bet. This solution is a good starting point. http://stackoverflow.com/a/16341162/1753596 – trh Aug 30 '15 at 17:14
  • For uploading large files you can process this in background with delayed job or something like this. – Rokibul Hasan Aug 30 '15 at 17:18

2 Answers2

1

Uploading large files through Heroku is generally not recommended. They limit the request to 30 seconds, which would not be enough time for 400MB.

If you are open to using S3, Heroku provides a potential Rails solution for that.

Anid Monsur
  • 4,538
  • 1
  • 17
  • 24
  • Timeout error is coming up after 10-20 minutes I guess. User told me that he can upload around 100 images (each image size 5-8 MB). But when uploading around 150 images, he get the timeout error. – fhaider Aug 30 '15 at 17:18
0

First solution is you can use refile gem.

Reason is " Effortless direct uploads, even to S3 "

This gem is from Jonas Nicklas, who is behind Carrierwave gem

refile

Blog on reason for refile gem

Second solution

move upload file into background jobs

praaveen V R
  • 1,259
  • 1
  • 11
  • 20