【发布时间】:2017-09-27 02:37:41
【问题描述】:
在我的应用程序中,用户可以从图库中选择一张图片,该图片将用于“用户详细信息”。因此,创建了一个屏幕,他存在一个名为“file”的输入文件。我需要将选择的图像复制到 externalDataDirectory。
我的问题是如何从选择复制的文件中获取 URI?
我的代码是……但每次都得到错误代码9,但我不知道这是什么意思。
inputFile = $( '.file' ).val();
window.resolveLocalFileSystemURL( cordova.file.externalDataDirectory, function( myFileEntry ){
window.requestFileSystem( LocalFileSystem.PERSISTENT, 0, function(fileEntry){
parentEntry = new DirectoryEntry( inputFile );
myFileEntry.getDirectory( "TRETA", {create: true, exclusive: false}, function(dir){
// copy the file to a new directory and rename it
fileEntry.root.copyTo( dir, "arquivo", function(entry){
console.log("New Path: " + entry.fullPath);
}, function(error){
console.log(error);
});
}, fail);
}, function(error){
console.log( error );
});
}, fail);
fffff
【问题讨论】:
标签: android cordova phonegap html5-filesystem