# RAILS\_ROOT Help Required!

**URL:** <https://www.ruby-forum.com/t/rails-root-help-required/55923>\
**Category:** Rails\
**Created:** [March 25, 2006, 10:04am UTC](https://www.ruby-forum.com/t/rails-root-help-required/55923 "2006-03-25T10:04:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrrzone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@hrrzone](https://www.ruby-forum.com/u/hrrzone)\
**Post date:** [March 25, 2006, 10:04am UTC](https://www.ruby-forum.com/t/rails-root-help-required/55923/1 "2006-03-25T10:04:26Z")

</div>

Hi,

I am new over here and also a newbie for Ruby on Rails. I am working on  
a simple webapp for my band work. I have created a upload  
controller/model and database which allows to save my files in the  
directory at /public/dump/. Uploading works but I can’t retrieve it.

I have tried several ways. The model uses DUMP\_PATH = RAILS\_ROOT +  
“/public/dump” to save the file. But when I use it in view as:

\<%= link\_to upload.filename, :action =\> RAILS\_ROOT + “/public/dump/” +  
upload.filename %\>

It doesn’t retrieve. I can’t access to the file even by using absolute  
paths. The HTML output is:

[DM100044.WMA](https://www.ruby-forum.com/upload/%2FUsers%2Frizwanreza%2Frails_projects%2Fbandwork%2Fpublic%2F..%2Fconfig%2F..%2Fpublic%2Fdump%2FDM100044.WMA)

I don’t what’s wrong. As I said, the absolute paths don’t work as well.

Thanks in advance. I have made the above possible by following this:  
[http://www.albert.bagasie.com/RailsTips/FileUpload](http://www.albert.bagasie.com/RailsTips/FileUpload)

Regards,

Rizwan R.

---

<div class="post-metadata">

**Author:** ![hrrzone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@hrrzone](https://www.ruby-forum.com/u/hrrzone)\
**Post date:** [March 25, 2006, 10:14am UTC](https://www.ruby-forum.com/t/rails-root-help-required/55923/2 "2006-03-25T10:14:38Z")

</div>

Because when you want an hyperlink to the file you don’t have to use  
RAILS\_ROOT : this will produce an absolute, filesystem related pathname.  
What you want is a relative path for public access which should be  
“/public/dump/” + upload.filename

---

<div class="post-metadata">

**Author:** ![hrrzone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@hrrzone](https://www.ruby-forum.com/u/hrrzone)\
**Post date:** [March 25, 2006, 11:10am UTC](https://www.ruby-forum.com/t/rails-root-help-required/55923/3 "2006-03-25T11:10:38Z")

</div>

Christophe G. wrote:

> Because when you want an hyperlink to the file you don’t have to use  
> RAILS\_ROOT : this will produce an absolute, filesystem related pathname.  
> What you want is a relative path for public access which should be  
> “/public/dump/” + upload.filename

Thanks for the reply. This worked: [\<%= upload.filename %\>](https://www.ruby-forum.com/dump/<%=%20upload.filename%20%0A%>)

Thank you very much.

Rizwan

---

<div class="post-metadata">

**Author:** ![hrrzone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@hrrzone](https://www.ruby-forum.com/u/hrrzone)\
**Post date:** [March 25, 2006, 11:21am UTC](https://www.ruby-forum.com/t/rails-root-help-required/55923/4 "2006-03-25T11:21:10Z")

</div>

Rizwan R. wrote:

> Thanks for the reply. This worked: [\<%= upload.filename %\>](https://www.ruby-forum.com/dump/<%=%20upload.filename%20%0A%>)

You’re welcome, and of course the right setting is without /public -  
Forgive me I’m awakening 😉
