Reason for file uploading problem with jQuery Mobile is that by default, form submits data using ajax. With Ajax, file input data is not submitted, and solution is very simple, just disable the ajax for forms submissions.
原文解决方法:
http://www.parorrey.com/blog/jquery-mobile/file-input-field-uploading-using-jquery-mobile-framework-form-submission-with-ajax-disabled/
最终的解决方法:
<%= form_for @ocr, :url => ocrs_path, :html => { :multipart => true, "data-ajax" => false } do |f| %>
<%= f.file_field :photo,{:name => 'photo[file]', :size => 100} %>
<%= f.submit %>
<% end %>
另外:
Rails3 中 file_field 不支持size属性