File_column problem


#1

I have been trying to use file_column, and it does work partially, the
files are uploaded to my server, but then when I do @user.icon it
returns nil. My file_column definition looks like this: file_column
:icon, :magick => {:size => “100x100” }

I display it in a form (with multipart) like this:
<%= file_column_field ‘user’, ‘icon’ %>

I have noticed in the params that the icon is a StringIO (which is
normal for files under 10kb), but icon_temp is nil. I am using
file_column .3.1.

Thanks,
Ben H.


#2

Hi Ben,

On 12/31/05, Ben H. removed_email_address@domain.invalid wrote:

I have been trying to use file_column, and it does work partially, the
files are uploaded to my server, but then when I do @user.icon it
returns nil. My file_column definition looks like this: file_column
:icon, :magick => {:size => “100x100” }

have you added a varchar column to your users table? This column will
hold the filename.

Sebastian


#3

have you added a varchar column to your users table? This column will
hold the filename.

Sebastian

Thanks, it now stores the URL, but when I try and access the image, it
gives me a routing error.


#4

Ben H. wrote:

have you added a varchar column to your users table? This column will
hold the filename.

Sebastian

Thanks, it now stores the URL, but when I try and access the image, it
gives me a routing error.

Make sure to use a file with an extension like .pdf. A file without an
extension like README will result in an routing error due to the stuff
in .htaccess or the default lighttpd config.

Jonathan


#5

Make sure to use a file with an extension like .pdf. A file without an
extension like README will result in an routing error due to the stuff
in .htaccess or the default lighttpd config.

Jonathan

I am using .jpg’s, although could my .htaccess or lighttpd config be
messed incorrect, since I am on Dreamhost?


#6

Ben H. wrote:

Make sure to use a file with an extension like .pdf. A file without an
extension like README will result in an routing error due to the stuff
in .htaccess or the default lighttpd config.

Jonathan

I am using .jpg’s, although could my .htaccess or lighttpd config be
messed incorrect, since I am on Dreamhost?

If you use Apache it is most likely that they allow you .htaccess
files and then it is under your control. But unless you changed it this
problem affects only files with no extension.

How to you access the image?

In the accessing view you need:

<%= url_for_file_column ‘user’, ‘icon’ %>

Jonathan


#7

How to you access the image?

Jonathan

I use this: <%= image_tag url_for_file_column(‘user’, ‘icon’), { :class
=> ‘profilepic’ } %>
Which is equivalent to what you said, right?


#8

Ben H. wrote:

How to you access the image?

Jonathan

I figured out the problem. For some reason the images were created with
incorrect permissions, which caused them to not be accessible.