当前位置:Gxlcms > PHP教程 > 七牛上传失败

七牛上传失败

时间:2021-07-01 10:21:17 帮助过:79人阅读

我用jquery.uploadfile做上传实例,代码如下:

var uploadObj = $("#fileuploader").uploadFile({
url:"http://up.qiniu.com/",
multiple:true,
autoSubmit:false,
fileName:"myfile",
formData: {"key":"","token":""},
maxFileCount:1,
showStatusAfterSuccess:false,
dragDropStr: "拖放文件",
abortStr:"放弃",
cancelStr:"终止",
doneStr:"OK",
multiDragErrorStr: "几个拖放文件是不允许的。",
extErrorStr:"不允许的扩展名",
sizeErrorStr:"不允许的大小",
uploadErrorStr:"禁止上传"
});
$("#startUpload").click(function()
{
    uploadObj.startUpload();
});

服务端错误是

{"error":"file is not specified in multipart"}

回复内容:

我用jquery.uploadfile做上传实例,代码如下:

var uploadObj = $("#fileuploader").uploadFile({
url:"http://up.qiniu.com/",
multiple:true,
autoSubmit:false,
fileName:"myfile",
formData: {"key":"","token":""},
maxFileCount:1,
showStatusAfterSuccess:false,
dragDropStr: "拖放文件",
abortStr:"放弃",
cancelStr:"终止",
doneStr:"OK",
multiDragErrorStr: "几个拖放文件是不允许的。",
extErrorStr:"不允许的扩展名",
sizeErrorStr:"不允许的大小",
uploadErrorStr:"禁止上传"
});
$("#startUpload").click(function()
{
    uploadObj.startUpload();
});

服务端错误是

{"error":"file is not specified in multipart"}

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

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

人气教程排行