file_column question

When using file_column, I found a situation where I wanted to hard code
what file the user uploads. So I wanted to do something like this:

So I wanted it to statically point to that file... however, this
doesn't work when I hit upload. Any idea what I'm doing wrong?

Ben Lisbakken

do you want still want to have a “browse” button? or nothing at all for the user to select an image?
if that is the case, just set the value of “picture” to the img path in your upload controller as you can’t set the value for a file upload in most broweser…
go to to read about HTML and other languages…its pretty handy
lookup “input” under HTML and you’ll find that The VALUE
attribute specifies the name of the initial file, but it is typically ignored by browsers as a security precaution.

I use file_column to upload images from either the file system or via a URL

check out my site at and upload a tile both ways…to see how it works…

I upload the file system img the normal way, but the URL way is all done in the controller, by simply over writting the file column attribute for the image, one the url is verified a legit url to an image

give me an email if you want some code snippits



Dion - thanks again for the help.

Dion was right - you can't set the value of a file field. So instead,
I placed a file_column_field down, and when the user put the source in
there, it would then "hide" itself (change the location of it, don't
hide it, safari doesn't like you hiding a file field), and a new
file_column_field would be put in it's place. Then when I hit upload,
it would upload all of the files the user wanted to upload.

The desired effect is exactly like this:

except done in rails.

-Ben Lisbakken

did you have to create a loop in your controller to save each of the images uploaded?

you got me interested in this, so I was mucking round and use the multifile script to upload multiple files

I have this in my controller, so it only saves the second file uploaded

@tile.img_name = params[:file_1]

it works, but how do you save each of the files in your controller?
do you just create a new record for each one, giving them the same attributes except for the img name?