I don’t know whether you can upload files via ajax, but you misspelt
‘file_field’… might be part of the problem if this is copied & pasted
from your code…
I’am trying to send multipart with ajax like this
<%= form_remote_tag :url => {:action => “upload” } %>
<%= file_filed “user”, “picture” %>
<%= submit_tag %>
<%= end_form_tag %>
But when i try get @params[:user][:picture] the value is nil
AJAX uploads are not supported out of the box, you can check this
page for help: http://sean.treadway.info/demo/upload/ and http://
sean.treadway.info/svn/plugins/responds_to_parent/README
If you’re really uncomfortable with all of this, just use the normal
form submit (don’t use ajax). It will be hard to maintain something
if you don’t understand how it works.
Best regards
Peter De Berdt
I’ve read the readme and even created a project thats exactly the same.
This line results not one but two RJS template errors.
Peter can you provide a simple example? Are you using file_column?
Im not very familiar with javascript so Id like to see a real :update
loop.
Peter De Berdt wrote:
On 26 Aug 2006, at 14:29, Bruno M. wrote:
I’am trying to send multipart with ajax like this
<%= form_remote_tag :url => {:action => “upload” } %>
<%= file_filed “user”, “picture” %>
<%= submit_tag %>
<%= end_form_tag %>
But when i try get @params[:user][:picture] the value is nil
AJAX uploads are not supported out of the box, you can check this
page for help: http://sean.treadway.info/demo/upload/ and http://
sean.treadway.info/svn/plugins/responds_to_parent/README
If you’re really uncomfortable with all of this, just use the normal
form submit (don’t use ajax). It will be hard to maintain something
if you don’t understand how it works.
I’ve read the readme and even created a project thats exactly the
same.
This line results not one but two RJS template errors.
page << “alert($(‘stuff’).innerHTML)”
Tsk tsk tsk, the readme is a quick and dirty draft, the form wasn’t
set to multipart, but as soon as you replace it with rails style erb
tags, everything runs fine.
Example:
class TestController < ApplicationController
def main
end
def form_action
# Do stuff with params[:uploaded_file]
if params[:uploaded_file]
responds_to_parent do
render :update do |page|
page << “alert(’#{params
[:uploaded_file].original_filename}’)”
end
end
else
render :nothing => true
end
end