views:

118

answers:

1

I use this code to upload photos, I find that it is not successfully upload photo, but other content can be updated.

<% semantic_remote_form_for(@product, :html => {:multipart => true}) do |f| %>  
  <% f.inputs do %>  
    <%= f.input :title, :label => "Name" %>  
    <%= f.input :category , :include_blank => false , :label => "Category" %>  
    <%= f.input :price, :label => "Price" %>  
    <%= f.input :photo, :label => "Photo" %>
  <% end %>  
  <%= f.buttons %>  
<% end %>

The code from server log:

DEPRECATION WARNING: Disabling sessions for a single controller has been deprecated. Sessions are now lazy loaded. So if you don't access them, consider them off. You can still modify the session cookie options with request.session_options.. (called from /onlineStore/app/controllers/application_controller.rb:6)

Processing ProductsController#update (for ::1 at 2010-01-23 22:03:54) [PUT] Parameters: {"commit"=>"Save Product", "authenticity_token"=>"vOvxOPYYE1wRGDYTEH5ciHrNJXUpGTJku3etIpCmf1c=", "id"=>"33", "product"=>{"price"=>"874", "title"=>"Other products", "category_id"=>"142"}, "_"=>""}

A: 

I'm surprised it worked at all, since Javascript is not supposed to be able to upload files via AJAX. Was the new switch the fact that you made it a remote form for the product? Since even though it's a gem helping with the semantic form building, even it shouldn't be able to do file uploads in that fashion.

Matchu
Sorry, I type wrong.... ... so, I can't use the remote form?? But I want the stuff reload all using js. How can I do?
Ted Wong