On Fri, Jul 3, 2009 at 12:40 PM, Gavin<[email protected]> wrote:
>
> Hey all!
>
> Im building an app at the moment in which users can upload images of
> themselves.
>
> The problem is, because these images are stored in the public
> directory they are open to the public.
>
> How can I protect these images but still allow access to them in my
> views?
>
> thanks
>
> Gavin

You'll need to explain protect but still allow access.
You could store them in another directory and then use send_file to
send the file after some form of authentication.
You can also do this with nginx (better scalability) via the method I
explain on my blog at
http://ramblingsonrails.com/how-to-protect-downloads-but-still-have-nginx-serve-the-files
A similar method exists for Apache.

Andrew Timberlake
http://ramblingsonrails.com

http://MyMvelope.com - The SIMPLE way to manage your savings

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to