我用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,就會報這個錯誤。首先,你要將input
的 name
設為file
,如果你用的是pluploader,可以在參數裡面設定這個值,仔細閱讀api