# How to reference a file for download

**URL:** <https://www.ruby-forum.com/t/how-to-reference-a-file-for-download/59354>\
**Category:** Rails\
**Created:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/how-to-reference-a-file-for-download/59354 "2006-05-03T18:58:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![larrywright](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc348/32.png) [@larrywright](https://www.ruby-forum.com/u/larrywright)\
**Post date:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/how-to-reference-a-file-for-download/59354/1 "2006-05-03T18:58:06Z")

</div>

I have an app that uploads files into the directory  
RAILS\_ROOT/documents/

I tried to access the file for downloading using my file.

Rails prepends the controller name to the link so I get

\<a href="  
[http://localhost:3000/tasks/show\_document/config/.../documents/file\_name](http://localhost:3000/tasks/show_document/config/.../documents/file_name)"

What’s the right way to do this?

thanks.

---

<div class="post-metadata">

**Author:** ![larrywright](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc348/32.png) [@larrywright](https://www.ruby-forum.com/u/larrywright)\
**Post date:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/how-to-reference-a-file-for-download/59354/2 "2006-05-03T18:58:23Z")

</div>

Put the files in RAILS\_ROOT/public/documents

This will make them accesible to anyone.

~ Ben

On 5/1/06, Larry W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> What’s the right way to do this?
> 
> thanks.
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Ben R.  
303-947-0446  
[http://www.benr75.com](http://www.benr75.com)

---

<div class="post-metadata">

**Author:** ![larrywright](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9fc348/32.png) [@larrywright](https://www.ruby-forum.com/u/larrywright)\
**Post date:** [May 3, 2006, 6:58pm UTC](https://www.ruby-forum.com/t/how-to-reference-a-file-for-download/59354/3 "2006-05-03T18:58:26Z")

</div>

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?
