All threads / File Uploads in Rails With Shrine Discussion
Ask A Question


You’re not receiving notifications from this thread.

File Uploads in Rails With Shrine Discussion

Request as you build the next few in the series that, if possible, you cover:
1) Direct upload to S3
2) JQuery/Multi-File/Background uploading


Yes! They're on my list! Also going to do video uploads with transcoding and taking thumbnails of them.

Thanks, Chris. The direct upload to S3 with JQuery has been on my list for awhile to figure out. It will be much appreciated!

jQuery file upload is one of the most confusing libraries to work with, so it was on my list to figure out for a while back when I first used it. Dropzone is actually a lot easier so I might use that one instead unless you're tied to jQuery file upload. The nice part about it is that the API is easier, and it doesn't care if you have jQuery or not so you can use it independently.

I saw Dromezone but I need a plugin that I can use in one input form ,for example: One blog with multiple picture. In this case first I need creat the blog and then upload a picture.

Dropzone will let you do that too. They're pretty equivalent in functionality. The trick is how you handle the uploads. For example, you can make Dropzone work (and look) exactly like jQuery file upload:

The multiple uploads is pretty easy, you send each over to the server, and it'll attach them to the Blog record by creating an individual "Media" record for each of your pictures, videos, etc. You have a one to many relationship server side to handle that stuff.

Shrine + Dropzone on the front-end would is a killer idea for a next video. Keep up the good work.

I'm not tied to jQuery. Dropzone looks very cool. Just like to be able to do a direct upload to S3 with multiple file drag and drop / background upload/processing. Sounds like that's where you are headed with the videos, so I am down. Thanks!

Great! Well I will possibly do both, but that's good to know. I think that's the more important thing, so long as the libraries support what you want!

Really great video. Thanks Chris!

Can you also cover secure upload/file retrieval together with direct upload to S3 and jquery/multi-file/background uploading (with progress bar)?

Nice one, Chris. Note Heroku allows you to save temporary files to its filesystem, but the files will be cleared every time the dyno is stopped/restarted. More on that here

That is correct! I'll be covering that in the future, this is more just the basic introduction. S3 will be coming shortly.

Great video, thanks. Note that the Shrine Homepage link should be http:// and not https://

what is the difference from the Shrine CarrierWave

See Shrine for CarrierWave Users for a brief introduction. Other differences include proper direct upload and backgrounding support (see the motivational blog post for explanation of the issues with CarrierWave). There are many more differences/advantages, I started writing about them more in depth on my blog :)

great video! looking forward to the seeing more of shrine.

Good point about the migration edits on the first one. I learned that the hard way with my first big development project and I have done it this way ever since.

Andrew Cockerham ·

How do you encrypt objects on s3? Paperclip has an option for amazon encryption, does shrine?

You'd have to look at Shrine's code for that, but if it doesn't support it yet, I'm sure it'd be very easy to add since it appears to simply be an additional header to add to requests. That would be a great open source contribution if it doesn't support it already!

If you look at the Shrine::Storage::S3 documentation, you'll notice that you can set :upload_options when initializing the storage, and this hash will automatically get forwarded to Aws::S3::Object#put on each upload, and that method supports options :server_side_encryption parameter, and any other :sse_* parameters you need.
upload_options: {server_side_encryption: "AES256", ...},

I found a error in this video, (i don't know it's ok ) but, when you make an update in one picture, the old picture does not disappear in Amazon s3

This episode was extremely helpful in getting Shrine up and running. I found the documentation to be less than clear, and this really helped.. Thank you!

Join the discussion

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

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

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

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.