Displaying 2 results from an estimated 2 matches for "file_fields_no".
2006 Mar 08
19
Creating multiple rows with one form
Hello. I''ve been trying this out for the past two days and I can''t seem to
get it. I''m going to have a page where you can upload x amount of images at
once. Lets say 10 images need to be uploaded, all with a caption.
I''d like to have a browse button to choose the file, then the caption. Now,
if I put 10 of them in one form, fill them all out and submit, I get
2006 Mar 05
2
How to clean up this code?
...uct user can delete any of images that belongs to
that product and add new ones, but i''ve got problems with naming files
added this way.
As i''m ror newbie, the code starts to become one big mess. Here it is:
--- product controller ----
def new
@product = Product.new
@file_fields_no = 4
@file_fields_no.times do @product.images << Image.new end
end
def create
@product = Product.new(params[:property])
if @product.save
uploaded_image_number = 0 # number of the uploaded file
save_image_number = 0 # number of the file that will be saved
on th...