我需要一些关于如何获取由cordova 相机插件挑选/拍摄的文件名称的提示。这是代码,我必须获取图片:
var options = {destinationType: Camera.DestinationType.NATIVE_URI};
options.sourceType = sourceType;
$cordovaCamera.getPicture(options).then(function (newURI) {
imageFileURI = newURI;
console.log('NATIVE_URI:\n' + imageFileURI);
//I need to get the file name and extension here
window.plugins.Base64.encodeFile(imageFileURI, function (base64Image) {
base64Data = base64Image;
}, function (error) {
console.log('Error while converting to base64: ' + error);
});
}, function (error) {
console.log('Error while picking a photo: ' + error);
});
Run Code Online (Sandbox Code Playgroud)
有没有办法,如何在需要的地方获取文件名和扩展名?谢谢