ホームページ >バックエンド開発 >PHPチュートリアル >七牛上传失败
我用jquery.uploadfile做上传实例,代码如下:
<code class="lang-javascript">var uploadObj = $("#fileuploader").uploadFile({ url:"http://up.qiniu.com/", multiple:true, autoSubmit:false, fileName:"myfile", formData: {"key":"<key>","token":"<mytoken>"}, maxFileCount:1, showStatusAfterSuccess:false, dragDropStr: "<span><b>拖放文件</b></span>", abortStr:"放弃", cancelStr:"终止", doneStr:"OK", multiDragErrorStr: "几个拖放文件是不允许的。", extErrorStr:"不允许的扩展名", sizeErrorStr:"不允许的大小", uploadErrorStr:"禁止上传" }); $("#startUpload").click(function() { uploadObj.startUpload(); }); </mytoken></key></code>
服务端错误是
<code class="lang-javascript">{"error":"file is not specified in multipart"} </code>
我用jquery.uploadfile做上传实例,代码如下:
<code class="lang-javascript">var uploadObj = $("#fileuploader").uploadFile({ url:"http://up.qiniu.com/", multiple:true, autoSubmit:false, fileName:"myfile", formData: {"key":"<key>","token":"<mytoken>"}, maxFileCount:1, showStatusAfterSuccess:false, dragDropStr: "<span><b>拖放文件</b></span>", abortStr:"放弃", cancelStr:"终止", doneStr:"OK", multiDragErrorStr: "几个拖放文件是不允许的。", extErrorStr:"不允许的扩展名", sizeErrorStr:"不允许的大小", uploadErrorStr:"禁止上传" }); $("#startUpload").click(function() { uploadObj.startUpload(); }); </mytoken></key></code>
服务端错误是
<code class="lang-javascript">{"error":"file is not specified in multipart"} </code>
http://segmentfault.com/q/1010000000326830
这个问题类似吗?应该是文件类型问题吧
我也遇到了这个问题,
如果图中标红的值不为file,就会报这个错误。首先,你要将input
的 name
设为file
,如果你用的是pluploader,可以在参数里面设置这个值,仔细阅读api