Forum: Ruby on Rails file uploading using ajax

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and 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

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

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

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

Thanks in advance

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

See this, for instance:
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.

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

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.