Ask A Question

Notifications

You’re not receiving notifications from this thread.

Limiting filesize upload when using Shrine + AWS S3

Masud Hossain asked in Rails

I built my file upload using Chris's guide (https://gorails.com/series/direct-uploads-to-amazon-s3), and i'm trying to figure out a way to increase limit the upload size of each file. Right now it seems like it's set to 5MB max.

Does anyone know how to do this?

Reply

Since this never really hits your Rails app and the uploads are direct to S3, the configuration is gonna have to be on the S3 side. This post here (https://aws.amazon.com/articles/1434) talks about setting a policy where you define the content-length-range which will correctly reject the file upload if it's outside those boundaries. I'm not quite sure exactly where that goes, possibly it has to be passed into the Shrine when it generates the presign signature unless it can be defined in S3 itself (which might be possible too). Probably work posting an issue on Shrine to ask for his advice there as he'd konw more about this than I do.

Reply

Found out the problem was nginx. There's a size limitation (http://prntscr.com/fz5713) on hatch under Nginx settings, so i changeg it to 900mb and now it's uploading fine.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.