Getting images from array


I have this kind of code source for uplaodin an image.
from controller:
def uploadFile
@text = “File has been uploaded successfully”

post =[:upload])
render :text => @text


from model:
name = upload[‘datafile’].original_filename
directory = “public/data”
#Creating the file path
path = File.join(directory, name)
#write the file,“wb”){ |f| f.write(upload[‘datafile’].read) }

But variable upload should be sent on array in new version. If i wan’t
to go through that array what is the easist way.
Do i have to do just loop. I am newbie on rails so i am lit bit
confused about the dynamic variables., this might help.

and yes, if you want to accept an array instead of a variable, then
you would need to loop through it so that you can save many images;

== controller

def upload_file # please don’t camel case
images = params[:images]
#do your stuff images

=== model

def images
images.each do |image|
# save files

But i strongly suggest you do it the rails way, as the files will be
much easier to manage.

Thanks for replay. I have to tried it by rails way.