`
iandaicsu
  • 浏览: 52087 次
社区版块
存档分类
最新评论

解决Jquery Mobile 不支持 file_field (上传文件)

    博客分类:
  • Ruby
 
阅读更多

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属性   

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics