relative path issue (noob)
Posted
by tim roberts
on Stack Overflow
See other posts from Stack Overflow
or by tim roberts
Published on 2010-05-11T20:40:20Z
Indexed on
2010/05/11
20:44 UTC
Read the original article
Hit count: 227
I am using the following code to check existence of a file before publishing an image in my erb file.
<% @imagename = @place.name + ".jpg" %>
<% if FileTest.exist?( "/Users/Tim/projects/game/public/" + @imagename ) %>
<p><img src= '<%= @imagename %>' width="400" height="300" /> </p>
<% end %>
And when I publish this to Heroku, it obviously wont work.
I tried using a relative path, but not able to get it to work. <% if FileTest.exist?( "/" + @imagename ) %>
any help appreciated.
© Stack Overflow or respective owner