Ajax - Upload File Upload

hello, i have a problem. I want to upload a file with ajax and the
following tag:

submit_to_remote ‘button_save’,‘Speichern’,{
:url => {:action => ‘ajax_update’, :id => @product},
:update => ‘formular’
}

it doesn’t work, my form_tag looks like:

form_remote_tag(:url => {:action => ‘update’, :id => @product},
:html => { :action => url_for(:action => ‘update’, :id =>
@product.id),
:enctype => “multipart/form-data”},
:update => ‘formular’)

and my input_tag:

<%= file_field(‘image’,‘image’) %>

If i watch my params at my “ajax_update” action, the
params[:image][:image] value is always nil instead of an I/O-String.

If i don’t use ajax to update it works perfectly.

Can anywone help me ? PLLLEEEAAASSSSEEEE

Johnson H. [email protected] writes:

hello, i have a problem. I want to upload a file with ajax and the
following tag:

There is no simple way to do AJAX file upload. Search, google and you
will
find many articles explaining that. There is also a Rails plugin, which
allows
you to upload files with a progress bar.

You can take out just the file upload code from there. It will require
use of
iframes.

HTH.


Surendra S.
http://ssinghi.kreeti.com, http://www.kreeti.com
Read my blog at: http://cuttingtheredtape.blogspot.com/
,----
| “O thou my friend! The prosperity of Crime is like unto the lightning,
| whose traitorous brilliancies embellish the atmosphere but for an
| instant, in order to hurl into death’s very depths the luckless one
| they have dazzled.” – Marquis de Sade
`----

This is PHP, but you can nevertheless use the concept.

http://developer.phpdoc.org/upload-progress-meter-v4.1

Johnson H. wrote:

hello, i have a problem. I want to upload a file with ajax and the
following tag:

submit_to_remote ‘button_save’,‘Speichern’,{
:url => {:action => ‘ajax_update’, :id => @product},
:update => ‘formular’
}

it doesn’t work, my form_tag looks like:

form_remote_tag(:url => {:action => ‘update’, :id => @product},
:html => { :action => url_for(:action => ‘update’, :id =>
@product.id),
:enctype => “multipart/form-data”},
:update => ‘formular’)

and my input_tag:

<%= file_field(‘image’,‘image’) %>

If i watch my params at my “ajax_update” action, the
params[:image][:image] value is always nil instead of an I/O-String.

If i don’t use ajax to update it works perfectly.

Can anywone help me ? PLLLEEEAAASSSSEEEE

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs