首頁 >後端開發 >php教程 >七牛上传失败

七牛上传失败

WBOY
WBOY原創
2016-06-06 20:47:101583瀏覽

我用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,就会报这个错误。首先,你要将inputname设为file,如果你用的是pluploader,可以在参数里面设置这个值,仔细阅读api

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn