File uploading using ajax

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 %>

<%= 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

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:

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-us&q=rails+upload+ajax&ie=UTF-8&oe=UTF-8

Best regards

Peter De Berdt

Use LiveQuery then you don’t need rjs and responds_to_parent

Guy B.

pena que parece que só funciona com jQuery…