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''
%><br>
<div id="files_list">Files (maximum 3):</div>
<script>
var multi_selector = new MultiSelector( document.getElementById(
''files_list'' ),3);
multi_selector.addElement( document.getElementById(
''file_data'' ) );
</script>
<p><%= f.submit:Create %></p>
<% 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,
Attachments:
http://www.ruby-forum.com/attachment/2841/application.js
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Have you looked at swfupload? Choose as many files as you want from a local folder and go... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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-
s.net> wrote:> 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''
%><br>
> <div id="files_list">Files (maximum 3):</div>
> <script>
> var multi_selector = new MultiSelector( document.getElementById(
> ''files_list'' ),3);
> multi_selector.addElement( document.getElementById(
''file_data'' ) );
> </script>
> <p><%= f.submit:Create %></p>
> <% 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,
>
> Attachments:http://www.ruby-forum.com/attachment/2841/application.js
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Have you tried paperclip from thoughtbot? http://www.thoughtbot.com/projects/paperclip/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---