Super noob question

68 views
Skip to first unread message

Gustavo Pares

unread,
Aug 29, 2018, 12:16:41 AM8/29/18
to Shrine
So  I'm a bit confused

when I upload my file lets say foo.jpg

why does it turn into 4329fkdkwefkwe42394302.jpg in aws s3?

can i user go and type the   aws_bucket_dir_whatever/foo.jpg and he can download the file if its public?

Hiren Mistry

unread,
Aug 29, 2018, 3:18:26 AM8/29/18
to Shrine
On Tuesday, August 28, 2018 at 9:16:41 PM UTC-7, Gustavo Pares wrote:
So  I'm a bit confused

when I upload my file lets say foo.jpg

why does it turn into 4329fkdkwefkwe42394302.jpg in aws s3?


If you used Shrine or some server upload library, the filenames are normally replaced by a unique id to prevent filename collision i.e. 2 different files with same name being upload into same folder. The original filename may be stored in an application database together with the file record.

 
can i user go and type the   aws_bucket_dir_whatever/foo.jpg and he can download the file if its public?

Yes.

 

Janko Marohnić

unread,
Aug 29, 2018, 8:22:11 AM8/29/18
to Hiren Mistry, ruby-shrine
can i user go and type the   aws_bucket_dir_whatever/foo.jpg and he can download the file if its public?

While the file will be uploaded to a unique location, the S3 Shrine storage will automatically "tell" the uploaded S3 object what its original filename is (through the Content-Disposition header), so that when the user downloads it later, it will be saved to disk with the original filename and not the unique identifier.

--
You received this message because you are subscribed to the Google Groups "Shrine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-shrine...@googlegroups.com.
To post to this group, send email to ruby-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ruby-shrine/a364157b-3ff1-4cc3-8fc7-893da8a67e04%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Don P

unread,
Apr 17, 2021, 3:32:23 PM4/17/21
to Shrine
Is there a setting or plugin that keeps the original file to be stored with the original filename?  The pretty_location plugin will keep the files in a unique directory structure so there should not be a chance of file name collisions.  We are migrating over from CarrierWave and it stored files in their original name and we have never had a collision.   Thanks!
Reply all
Reply to author
Forward
0 new messages