我正在嘗試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