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.
dare r. (Guest)
on 2009-01-10 08: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

Jeroen J. (Guest)
on 2009-01-10 09: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:
Peter De Berdt (Guest)
on 2009-01-10 17: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
guyb (Guest)
on 2009-02-11 23:06
(Received via mailing list)
Use LiveQuery then you don't need rjs and responds_to_parent

Guy B.
Mathieu R. (Guest)
on 2009-02-12 12:25
(Received via mailing list)
pena que parece que só funciona com jQuery...
This topic is locked and can not be replied to.