5

I've successfully uploaded a file using PUT and html, but is there a way to upload a file in a ajax remote_form_for ?

I've tried this to no success:

<% remote_form_for @song,:html => { :multipart => true }, :url => { :action => 'upload' } do |f| %>
1
  • What kind of error do you get? Commented Sep 5, 2009 at 3:09

2 Answers 2

10

If you're using Rails 3, try the Remotipart gem. It makes AJAX style file uploads relatively painless.

http://rubygems.org/gems/remotipart

http://github.com/leppert/remotipart

Sign up to request clarification or add additional context in comments.

Comments

2

The standard remote_form_for doesn’t understand multipart form submission so you can't actually do this without some leg-work as indicated by yoda above.

The other way to achieve this is by using an iframe.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.