我正在嘗試phonegap文件傳輸API上傳文件到遠程服務器,它工作正常。但我有問題獲取原始文件路徑。 'imageURI'返回臨時路徑,所以我嘗試了「window.resolveLocalFileSystemURI」來獲取原始路徑。但是下面的代碼不會返回任何路徑。請幫助我知道我錯在哪裏。從Phonegap原始圖像路徑文件傳輸API
<script>
function getphoto() {
navigator.camera.getPicture(uploadPhoto, function(message) {alert('get picture failed');
}, { quality:10, destinationType:navigator.camera.DestinationType.FILE_URI, sourceType:navigator.camera.PictureSourceType.PHOTOLIBRARY });
}
function uploadPhoto(imageURI)
{
window.resolveLocalFileSystemURI(imageURI, gotFileEntry, function(error){onfail(console.log("Error get fullPath"))});
}
function gotFileEntry(imageURI) {
alert("imageURI: "+imageURI);
//not getting imageURI
}
</script>
感謝
這背後越來越原來的文件路徑的意義? –
從文件名我需要檢查圖像是否已經上傳.. – Dev
和上面的代碼只顯示上傳時,在手機上的JPG圖像。有沒有辦法我可以上傳所有圖像類型? – Dev