Forum: Ruby on Rails file uploading using ajax

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B736ee289a70ae21e323ed2f808dd0ce?d=identicon&s=25 dare ruby (martin_mercy2001)
on 2009-01-10 07:37
Dear all,

I have a doubt, iam not getting the uploaded file when iam uploading
using ajax form like,

   <% remote_form_for(:videos, :url => {:controller => :videos, :action
=> :add },
   :html => { :multipart => true, :ajaxupload => true }) do |form| %>

   File <%= form.file_field :uploaded_data %><br/><br/>

   <%= submit_tag "uploadfile"%>

In controller when i call

  params[:videos][:uploaded_data], iam getting a string like filename
<sample.gif>

but i was not able to reterive the uploadedfile and when i call methods
like

params[:videos][:uploaded_data].original_filename,
params[:videos][:uploaded_data].read iam getting errors.

So could anyone please suggest how to perform file uploading using ajax.

Thanks in advance

Regards,
Martin
D75f4b92f64038bcb02995694c1c9984?d=identicon&s=25 Jeroen Janssen (joran)
on 2009-01-10 08:34
(Received via mailing list)
I don't think it's possible to upload files with AJAX, but there are
some workarounds with hidden iFrames. It's not very elegant, but it
works.

See this, for instance:
http://kpumuk.info/ruby-on-rails/in-place-file-upl...
00973881979aa0a660ffbbb2f7a907fb?d=identicon&s=25 Peter De Berdt (Guest)
on 2009-01-10 16:29
(Received via mailing list)
On 10 Jan 2009, at 07:37, dare ruby wrote:

> So could anyone please suggest how to perform file uploading using
> ajax.

http://www.google.com/search?client=safari&rls=en-...


Best regards

Peter De Berdt
D3190763a5eb436d98998757d22e2288?d=identicon&s=25 guyb (Guest)
on 2009-02-11 22:06
(Received via mailing list)
Use LiveQuery then you don't need rjs and responds_to_parent

http://rails-revlog.blogspot.com/2009/02/ajax-sort...

Guy Boertje
Ca0d1fa83b8d8f39a51c0f25b0f17336?d=identicon&s=25 Mathieu Rousseau (Guest)
on 2009-02-12 11:25
(Received via mailing list)
pena que parece que só funciona com jQuery...
This topic is locked and can not be replied to.