Multiple file upload


#1

Hi,
i am trying for uploading multiple files using attachment_fu plugin.
i use MultiSelector javascript for this purpose.It helps me to store
minimum three files before uploading.but when i deleted one file
and replace with another file.the rest of the files including this
files are not save in the database.

i include required javascript files as attachment.
here is my code,
in view

<% form_for :fileindex, :url => { :action => ‘create’ }, :html => {
:multipart => true } do |f| %>
<%= javascript_include_tag “multifile_compressed”%>
<%= file_field ‘file’, ‘data’ %>

Files (maximum 3):


<%= f.submit:Create %>


<% end %>

in controller:
def create
i = 0
while params[‘file_’+i.to_s] !="" && !params[‘file_’+i.to_s].nil?

puts params[‘file’+i.to_s]

p = Hash[“fileindex”=>{“uploaded_data”=>""}]

puts p

p[“fileindex”][“uploaded_data”] = params[“file_”+i.to_s]

puts p[“Fileindex”].size

if p[“Fileindex”].size>0

@fileindex = Fileindex.create! p["fileindex"]

end

i += 1
end
end

any urgent help is required.
thanks,


#2

May I know y u need 3 uploads at a time. I guess with attachment_fu u
cant upload and save multiplt files at one shot. Instead u need to
itrate and save.

if u could explain the requirement I may suggest an alternative
solution.

Anyway Is the requirement related to praps.com ??

Regards,
Ratnavel.


#3

Ratnavel P S wrote:

May I know y u need 3 uploads at a time. I guess with attachment_fu u
cant upload and save multiplt files at one shot. Instead u need to
itrate and save.

if u could explain the requirement I may suggest an alternative
solution.

Anyway Is the requirement related to praps.com ??

Regards,
Ratnavel.

thanks Ratnaval,
i want to upload multiple files.in view page i attach
may one ,two or three(maximum three)files without delete
any files and upload those files.it works beautifully.
all files are successfully saved in the database.
but there exist a delete button.If i delete one
attach files and replace it with another file and try to
upload it,it not works.the changed file is not save in
the database.


#4

Have you looked at swfupload? Choose as many files as you want from a
local folder and go…


#5

hi Subhadip Chakraborty,

 iam trying to upload multiple files using attachment_fu

plugin …i have followed by ur code but i did’t get it… can u plz
explain it more briefly… its very urgent…

 thanks in advance,

regards,
chowdari

On Oct 22, 2:53 pm, Subhadip Chakraborty <rails-mailing-l…@andreas-


#6

Have you tried paperclip from thoughtbot?
http://www.thoughtbot.com/projects/paperclip/