1
我正在用xcode在mac os中開發一個phonegap項目。在xcode中,如果我創建一個基於cordova的應用程序,它會自動創建cordova-1.6.0.js。我使用fileupload插件發送svg文件到我的服務器。在fileupload.js我已經寫了警報fileuplaoder功能,如下圖所示ios中的fileupload插件無法正常工作
var FileUploader = function() {
alert("gi");
}
此警報的工作,但是當我給下上傳功能的ALER,
FileUploader.prototype.upload = function(server, file, params, fileKey, fileName, mimeType, success, fail, progress) {
alert("upload");
this._doUpload('upload', server, file, params, fileKey, fileName, mimeType, success, fail, progress);
};
此警報不工作。我在html頁面中的這個插件的呼叫是,
window.plugins.fileUploader.upload('http:192.168.1.54:8080/downloadFiles', '/Users/User/Library/Application Support/iPhone Simulator/5.0/Applications/408DBBC7-67F7-4E8B-B41C-663CDC0377B5/Documents/image5_1.jpg.txt.svg', {foo: 'bar'}, 'myPhoto', 'image5_1.jpg.txt.svg', 'image/svg',
function(result) {
console.log('Done: ' + result);
},
function(result) {
console.log("Error: " + result);
},
function(loaded, total) {
var percent = 100/total * loaded;
console.log('Uploaded ' + percent);
}
);
在fileupload.js中有cordova.addConstructor方法。但在我生成的cordova.1.6.0.js文件中沒有這種方法。我不知道發生了什麼。 pl幫我做這個插件。
大家好,pl幫我解決我上面的問題。我需要答案。 – mmathan