html表单提交,PHP端$_FILES正常。appcan请求,PHP收到的$_FILES信息为空数组
html页面如下:
appcan:
uexWindow.actionSheet({
title: "选择图片",
cancel: "取消",
buttons: "照相机拍摄,本地图片"
}, function(index) {
switch(parseInt(index)){
case 0:
// 照相机拍摄
// uexCamera.open();
break;
case 1:
// 本地图片
var data = {
min:1,
max:9,
quality:0.8,
detailedInfo:true
}
uexImage.openPicker(data, function(error,info) {
if (error == -1) {
//alert("cancelled!");
} else if(error == 0) {
//alert(info.data);
if (info.detailedImageInfo) {
// var files = info.detailedImageInfo
addAlbum(info.detailedImageInfo)
//alert(JSON.stringify(info.detailedImageInfo));
}
} else {
alert("error");
}
});
break;
}
});
})
var albumId = 0
//console.log(HOST_URL+"/index.php?s=/App/User/addphoto" + getRequestPath() + '/id/' + albumId)
function addAlbum(files) {
if (files.length == 0) {
uexWindow.toast("1", "5", "图片上传结束", "0");
albumId = 0
return
}
var filePath = files[0].localPath
// 删除上传图片
files.splice(0,1)
//alert(filePath);
upload(filePath, function() {
addAlbum(files)
})
}
function upload(filePath, callback) {
//alert(filePath)
var uploader = uexUploaderMgr.create({
//url: HOST_URL+"/index.php?s=/App/User/addphoto" + getRequestPath() + '/id/' + albumId,
url: HOST_URL+"/upload.php",
//url: "http://yy2.rxqqlx.com/index.php?s=/Home/Album/add_photo/app/1/uid/-24892674",
type: 1
});
if(!uploader){
alert("创建失败!");
}
//var headJson = {"myHeaderKey":"myHeaderValue"};
//var ret = uexUploaderMgr.setHeaders(uploader, JSON.stringify(headJson));
//alert(ret);
uexUploaderMgr.uploadFile(uploader, filePath, "file", 0, 600, function(packageSize, percent, responseString, status){
switch (status) {
case 0:
uexWindow.toast("1", "5", percent+"%", "0");
break;
case 1:
if (albumId == 0) {
// appcan.window.publish('reloadMyAlbum')
}
// albumId = ''
alert("上传成功packageSize:"+packageSize+",服务器response:"+responseString);
uexWindow.closeToast();
// uexWindow.toast("0","5","图片成功上传!","2000");
// alert("上传成功,服务器response:"+responseString);
callback()
break;
case 2:
alert("图片上传失败"+responseString);
//uexWindow.closeToast();
uexWindow.toast('0','5',"图片上传失败",2000);
callback()
break;
default:
uexWindow.closeToast();
alert("上传失败1");
break;
}
});
}
QQ截图20161223113005.png (266.55 KB, 下载次数: 39)
2016-12-23 11:30 上传
PHP服务端$_FILES为空数组array()
不知道是php配置问题还是appcan上传头的问题。请求支援。
注:html上传是正常的。