我试图支持uploadify
,但它给了我这个错误。基本上我有一个命名为. 对于单次上传,它适用于carrierwave,但对于多个文件则不然。carrierwave
multiple file upload
GET http://localhost:3000/users/uploadify.swf?preventswfcaching=1361694618739
model
user
我已经按照本教程进行操作。在users/_form.rb
<p>
<%= f.label "Upload Images"%>
<%= f.file_field :image, :multiple => true %>
</p>
<script type= "text/javascript">
$(document).ready(function() {
<% key = Rails.application.config.session_options[:key] %>
var uploadify_script_data = {};
var csrf_param = $('meta[name=csrf-param]').attr('content');
var csrf_token = $('meta[name=csrf-token]').attr('content');
uploadify_script_data[csrf_param] = encodeURI(encodeURIComponent(csrf_token));
uploadify_script_data['<%= key %>'] = '<%= cookies[key] %>';
$('#user_image').uploadify({
uploader : '<%= asset_path("uploadify.swf")%>',
script : '/images',
cancelImg : '<%= asset_path("uploadify-cancel.png")%>',
auto : true,
multi : true,
removeCompleted : true,
scriptData : uploadify_script_data,
onComplete : function(event, ID, fileObj, doc, data) {
}
});
});
</script>
我正在使用 mongoid 所以模型是这样的
class User
include Mongoid::Document
field :name, type: String
field :description, type: String
field :image, type: String
mount_uploader :image, ImageUploader
end
我没有得到什么是错误。请帮帮我。