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:

http://pastie.caboo.se/11733

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?

Thanks,
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 http://gotapi.com/ 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 www.blogsaic.com 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

cheers

dion

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:
http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/

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?

cheers

dion