0
這是我的代碼請幫助我這是我的代碼...我在.net中的Web服務如何使用Java腳本傳遞圖像並獲取.net Web服務和存儲文件夾,並重新獲得它。我曾試過這個敏。 3小時但我沒能得到解決,請幫我...我無法發送圖像在.net web服務使用javascript
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
// Retrieve image file location from specified source
navigator.camera.getPicture(uploadPhoto,
function(message) { alert('get picture failed'); },
{ quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY }
);
}
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType="image/jpeg";
var params = {};
params.value1 = "test";
params.value2 = "param";
options.params = params;
var ft = new FileTransfer();
alert(imageURI);
ft.upload(imageURI, encodeURI("http://www.gameworld.co.in/useImage"), win, fail, options);
}
function win(r) {
console.log("Code = " + r.responseCode);
console.log("Response = " + r.response);
console.log("Sent = " + r.bytesSent);
}
function fail(error) {
alert("An error has occurred: Code = " + error.code);
console.log("upload error source " + error.source);
console.log("upload error target " + error.target);
}
如果你有其他的解決方案,那麼請告訴我... 感謝
路徑嘗試設置'options.chunkedMode = false;' –
它不工作....什麼是代碼1錯誤的含義?我的服務是否被調用我如何檢查? – Nik
錯誤代碼1是FILE_NOT_FOUND_ERR。如果您使用的是android,請選中[answer](http://stackoverflow.com/questions/11754299/phonegap-android-unable-to-upload-image-using-filetransfer/14220608#14220608) –