我正在使用cordova文件传输插件将图像上传到我们的服务器。我面临以下问题。
var uploadObject = {uploadSuccess:0, uploadFailure:0};
function uploadImage(fileURL,pic_upload_url,mode){
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
options.mimeType = "text/plain";
var params = {};
params.value1 = "";
params.value2 = "";
options.params = params;
options.chunkedMode = false;
var ft = new FileTransfer();
ft.upload(fileURL,encodeURI(pic_upload_url + "?path=" + options.fileName + "&img_mode="+mode+""), win, fail, options);
}
var win = function (r) {
uploadObject.uploadSuccess++;
}
var fail = function (error) {
uploadObject.uploadFailure++;
}
在成功上传后,我正在更新对象成功,同样失败了。
我想将此函数中的内容返回到另一页上的变量中,以便进行进一步的验证。 谢谢!