我正在网络浏览器中测试我的phonegap应用,并在控制台中获取以下内容:
'FileTransfer' is undefined
尝试了以下内容:
1)安装插件,插件列表显示:
cordova-plugin-file 2.0.0-dev "File"
cordova-plugin-file-transfer 1.0.0-dev "File Transfer"
cordova-plugin-media-capture 1.0.0-dev "Capture"
org.apache.cordova.file 1.3.3 "File"
org.apache.cordova.file-transfer 0.5.0 "File Transfer"
2)在config.xml中添加了以下行
<feature name="File"><param name="ios-package" value="CDVFile" /></feature>
<feature name="FileTransfer"><param name="ios-package" value="CDVFileTransfer" /></feature>
3)尝试在html页面上包含js文件 4)已经读过FileTransfer只能在设备准备好后调用, 但是按下单击按钮调用该功能 - 这在设备准备好之后就会发生。
已阅读有关此问题的大多数帖子,但我现在真的陷入困境 - 请告知TQ
//js
function uploadFile_S3(vidfile) {
var filetype = vidfile.type;
var filename_orig = vidfile.name;
var deferred = $.Deferred(),
ft = new FileTransfer(),
options = new FileUploadOptions();
options.fileKey = filename;
options.fileName = filename;
options.mimeType = filetype;
options.chunkedMode = false;
options.params = {
"key": filename,
"AWSAccessKeyId": 'XXX',
"acl": 'public-read',
"policy": policyBase64,
"signature": signature,
"Content-Type": "image/jpeg"
};
ft.upload(imageURI, s3URI,
function (e) {
deferred.resolve(e);
},
function (e) {
deferred.reject(e);
}, options);
return deferred.promise();
}