Forum: Ruby on Rails how to reference a file for download

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D4b246038154d7cc2363256bd25a4fe0?d=identicon&s=25 Larry White (Guest)
on 2006-05-03 18:58
(Received via mailing list)
I have an app that uploads files into the directory
RAILS_ROOT/documents/

I tried to access the file for downloading using <a
href="#{RAILS_ROOT}/documents/file_name">my file</a>.

Rails prepends the controller name to the link so I get

<a href="
http://localhost:3000/tasks/show_document/config/....

What's the right way to do this?

thanks.
D90ef6808433e63203e15a5c2dadb0bb?d=identicon&s=25 Ben Reubenstein (Guest)
on 2006-05-03 18:58
(Received via mailing list)
Put the files in RAILS_ROOT/public/documents

This will make them accesible to anyone.

~ Ben

On 5/1/06, Larry White <ljw1001@gmail.com> wrote:
>  What's the right way to do this?
>
>  thanks.
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>


--
Ben Reubenstein
303-947-0446
http://www.benr75.com
D4b246038154d7cc2363256bd25a4fe0?d=identicon&s=25 Larry White (Guest)
on 2006-05-03 18:58
(Received via mailing list)
That's the problem :-)
They're not supposed to be accessable to everyone. Access needs to be
restricted through a controller.

If they go in public is there anyway to filter access?
This topic is locked and can not be replied to.