以下是回复onError
:
{
"type": "HTTP",
"info": 500
}
后端PHP脚本可以使用常规multipart/form-data
表单。但是当我使用Uploadify时,它会在onOpen
事件之后立即返回错误。我查了php和apache日志,没有关于这个错误。我甚至尝试在PHP代码中使用echo
某些东西,但这并没有出现在任何地方。我在端口80上使用MAMP在本地运行它。我正在使用Code Igniter,并且有一个名为process
的控制器和函数upload_image()
,因此链接也没有被破坏。
这是我的uploadify js代码:
$('#browse-files').uploadify({
'uploader' : '/libraries/uploadify/uploadify.swf',
'script' : '/process/upload_image',
'folder' : '/uploads/',
'cancelImg' : '/libraries/uploadify/cancel.png',
'buttonImg' : '/images/upload.png',
'auto' : true,
'height' : 40,
'width' : 313,
'auto' : true,
'simUploadLimit': '1',
'multi' : true,
'method' : 'post',
'fileExt' : '*.jpg;*.jpeg;*.JPEG;*.JPG;*.gif;*.png',
'fileDesc' : 'Web Image Files (.JPG, .GIF, .PNG)',
'fileDataName' : 'file',
'onOpen' : function(event, id){
console.log("Starting to upload an image"); //this shows up in console
},
'onProgress': function(event, id, fileObj, data){
console.log("Progress: "+data.percentage);
},
'onComplete': function(event, id, fileObj, resp, data){
console.log("Upload is done.");
console.log(resp);
},
'onAllComplete': function(event, data){
console.log("All uploads are done.");
},
'onError' : function(event, id, fileObj, errorObj){
console.log( JSON.stringify(errorObj) ); //and this prints the error above
}
});