我正在尝试uploadify
与carrierwave
以支持multiple file upload
,但它给了我这个错误GET http://localhost:3000/users/uploadify.swf?preventswfcaching=1361694618739
。 基本上我有一个model
命名为user
。对于单一上传,它与Carrierwave正常工作,但对于多个文件,它不是。使用carrierwave和uploadify时上传错误
我跟着this教程。 在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
我不是得到什么是错误。请帮助我。
您只发布了GET请求,而不是实际的错误。请发布错误。 – Jesper 2013-02-24 12:53:28
这是我进入js控制台的错误。其实,浏览文件按钮不起作用。 – 2013-02-24 20:18:32
请理解'GET http:// localhost:3000/users/uploadify.swf?preventwfcaching = 1361694618739'并不是错误,它只是一个声明。请给我们实际的错误。 – Jesper 2013-02-24 20:37:55