Home > Backend Development > PHP Tutorial > 七牛上传失败

七牛上传失败

WBOY
Release: 2016-06-06 20:47:10
Original
1576 people have browsed it

我用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>
Copy after login
Copy after login

服务端错误是

<code class="lang-javascript">{"error":"file is not specified in multipart"}
</code>
Copy after login
Copy after login

回复内容:

我用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>
Copy after login
Copy after login

服务端错误是

<code class="lang-javascript">{"error":"file is not specified in multipart"}
</code>
Copy after login
Copy after login

http://segmentfault.com/q/1010000000326830
这个问题类似吗?应该是文件类型问题吧

我也遇到了这个问题,七牛上传失败
如果图中标红的值不为file,就会报这个错误。首先,你要将inputname设为file,如果你用的是pluploader,可以在参数里面设置这个值,仔细阅读api

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template