Closed sunbo closed 11 years ago
我这里测试,多图片上传是正常可用的,没有错误。
多图片上传实际上只是多次调用单图片上传的代码,没什么区别。
从你的log看,是401 Unauthorized错误,你看看是不是哪里权限配置有问题。
多个图片上传也是传到public/uploads下吧,一个图片上传是可以,应该没有权限问题,我是本地测试的。 多个图片上传 content_type="application/octet-stream" 一个图片上传 content_type="image/jpeg" 会不会是这个问题?
我上传两张图片的log是这样的,没有问题。
Started POST "/kindeditor/upload?dir=image" for 127.0.0.1 at 2013-08-21 23:03:04 +0800
Processing by Kindeditor::AssetsController#create as HTML
Parameters: {"Filename"=>"2013060204.jpg", "imgFile"=>#<ActionDispatch::Http::UploadedFile:0x007ff79b386608 @tempfile=#<Tempfile:/var/folders/z0/j5pmgzyd5lvdx1tmg5xvvp800000gn/T/RackMultipart20130821-592-kfq8rs>, @original_filename="2013060204.jpg", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"imgFile\"; filename=\"2013060204.jpg\"\r\nContent-Type: application/octet-stream\r\n">, "Upload"=>"Submit Query", "dir"=>"image"}
(0.1ms) begin transaction
Binary data inserted for `string` type on column `file_type`
SQL (0.5ms) INSERT INTO "kindeditor_assets" ("asset", "asset_type", "created_at", "file_size", "file_type", "owner_id", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["asset", "d473038c5354.jpg"], ["asset_type", "image"], ["created_at", Wed, 21 Aug 2013 15:03:04 UTC +00:00], ["file_size", 21816], ["file_type", "application/octet-stream"], ["owner_id", 0], ["updated_at", Wed, 21 Aug 2013 15:03:04 UTC +00:00]]
(0.8ms) commit transaction
Rendered text template (0.0ms)
Completed 200 OK in 58ms (Views: 0.5ms | ActiveRecord: 1.7ms)
Started POST "/kindeditor/upload?dir=image" for 127.0.0.1 at 2013-08-21 23:03:04 +0800
Processing by Kindeditor::AssetsController#create as HTML
Parameters: {"Filename"=>"2013060205.jpg", "imgFile"=>#<ActionDispatch::Http::UploadedFile:0x007ff79f8bcd80 @tempfile=#<Tempfile:/var/folders/z0/j5pmgzyd5lvdx1tmg5xvvp800000gn/T/RackMultipart20130821-592-vs9hlt>, @original_filename="2013060205.jpg", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"imgFile\"; filename=\"2013060205.jpg\"\r\nContent-Type: application/octet-stream\r\n">, "Upload"=>"Submit Query", "dir"=>"image"}
(0.1ms) begin transaction
Binary data inserted for `string` type on column `file_type`
SQL (0.5ms) INSERT INTO "kindeditor_assets" ("asset", "asset_type", "created_at", "file_size", "file_type", "owner_id", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["asset", "33e2a80b3dd1.jpg"], ["asset_type", "image"], ["created_at", Wed, 21 Aug 2013 15:03:04 UTC +00:00], ["file_size", 23871], ["file_type", "application/octet-stream"], ["owner_id", 0], ["updated_at", Wed, 21 Aug 2013 15:03:04 UTC +00:00]]
(0.6ms) commit transaction
Rendered text template (0.0ms)
Completed 200 OK in 10ms (Views: 0.4ms | ActiveRecord: 1.2ms)
目前没有更多反馈,此问题暂时关闭。
我野发现了这个问题,但是应该市kindeditor的问题,多图上传的时候如果带权限管理那么就会出错.
例如,我要求使用编辑器必须登陆,require_login
,那么酒无法取得current_user
值,我猜测是cookie
问题.
这个是上传多个图片时的log,失败
这个是上传1个图片时的log,成功