这可能很简单,而且PhoneGap的“相机”插件、“文件”插件或“文件传输”插件中的一些功能结合在一起。据我所知,用户可以通过以下方式选择一个文件:
navigator.camera.getPicture(function (fileURI) {
// *** need help here ***
}, function ()
// handle errors
}, {
destinationType: window.Camera.DestinationType.FILE_URI,
sourceType: window.Camera.PictureSourceType.PHOTOLIBRARY,
mediaType: window.Camera.MediaType.ALLMEDIA
});如果有什么不同,我也可以更改为destinationType: window.Camera.DestinationType.DATA_URL。
我在成功处理程序中的目标是获得一个文件对象(https://developer.mozilla.org/en-US/docs/Web/API/File)。
发布于 2014-03-03 20:00:33
像这样的东西应该能行。
navigator.camera.getPicture(function (fileURI) {
window.resolveLocalFileSystemURL(fileURI,
function(fileEntry){
alert("got image file entry: " + fileEntry.fullPath);
// fileEntry.file() should return a raw HTML File Object
},
function(){//error}
);
}, function (){
// handle errors
}, {
destinationType: window.Camera.DestinationType.FILE_URI,
sourceType: window.Camera.PictureSourceType.PHOTOLIBRARY,
mediaType: window.Camera.MediaType.ALLMEDIA
});https://stackoverflow.com/questions/22153644
复制相似问题