file upload problem when using form_remote_tag

Hi     I have a form like <%= form_remote_tag :url => { :action => 'attach_file',                               :id => @sd_ticket.id },                                     :enctype => 'multipart/form-data' %>

<table cellpadding="4" cellspacing="0" border="0" width="100%" class="itiltable2">

<tr>     <td width="25%"><%= text_area "service_desk_attachment1", "description", "cols" => 50, "rows" => 1 %></td>

    <td width="25%" colspan="4"><%= upload_column_field 'service_desk_attachment1', 'attachment' %></td>

</tr> <button type="submit" value="save" >Attach File</button> <%=end_form_tag %>

This is not working (the file not uploaded) WHAT I GET ON THE CONTROLLER IS AS A RESULT OF

puts params[:service_desk_attachment1][:description] puts params[:service_desk_attachment1][:attachment] IS

file1 D:\Sijo\file1.txt

BUT THE SAME WAS WORKING WITH THE FOLLOWING .ie JUST WHEN IT WAS start_form_tag instead of form_remote_tag as

<%= start_form_tag ({:action => 'attach_file', :id => @sd_ticket.id, :method => 'post'}, :enctype => 'multipart/form-data')%>

THE ABOVE IS WORKING(the file not uploaded), AND I GET IN THE CONTROLLER file1 #<StringIO:0x47cee90>

WHY THIS HAPPENS PLEASE HELP Sijo

as far as I know, you can't upload files through an AJAX call. Also, start_form_tag is deprecated, so you shouldn't use that anymore.

Mike

use form_tag

yes, there is way but you have to use the "iframe remoting pattern" to do that

This great tutorial was a great help (just a walktrough): http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent

maerzbow http://blog.odeley.com

Hi   And finally I suceeded in the file upload (ajaxway) using responds_to_parent,uploadcolumn with iframe remoting pattern

Thanks for your help Sijo