How to store private pictures and videos in Ruby on Rails
Posted
by TK
on Stack Overflow
See other posts from Stack Overflow
or by TK
Published on 2010-05-02T04:55:30Z
Indexed on
2010/05/02
4:57 UTC
Read the original article
Hit count: 284
Here's a story:
- User A should be able to upload an image.
- User A should be able to set a privacy. ("Public" or "Private").
- User B should not be able to access "Private" images of User A.
I'm planning to user Paperclip for dealing with uploads.
If I store the images under "RAILS_ROOT/public/images", anyone who could guess the name of the files might access the files. (e.g., accessing http://example.com/public/images/uploads/john/family.png )
I need to show the images using img
tags, so I cannot place a file except public
.
How can I ensure that images of a user or group is not accessible by others?
© Stack Overflow or respective owner