我正在尝试 phonegap 文件传输 API 将文件上传到远程服务器,它工作正常。但我在获取原始文件路径时遇到问题。“imageURI”返回临时路径,所以我尝试“window.resolveLocalFileSystemURI”来获取原始路径。但以下代码不返回任何路径。请帮助我知道我错在哪里。
<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>
谢谢