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.
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
<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
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
works.

See this, for instance:
http://kpumuk.info/ruby-on-rails/in-place-file-upl...
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.

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


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

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

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.