Open hako2008 opened 7 months ago
@hako2008 I have encountered the same problem, have you found a solution?
I don't think recursive directory creates are supported.
e.g. you must first check if images
is created and if not, create the directory, then check for profile
directory and create it if it doesn't exist.
Directly attempting to create (or get) images/profile
will fail if images
is not already created. Likewise, attempting to download to a directory whose path isn't available will also fail. This is noted here
In otherwords:
entry.getDirectory("images/profile", {
create: true
}, onGetDirectorySuccess, onGetDirectoryFail);
this is unsafe unless images
directory is guaranteed to exist which is an unsafe assumption for applicationStorageDirectory
directory. It needs to be split into 2 getDirectory calls, cascaded into their respective callbacks.
entry.getDirectory("images", {
create: true
}, (imagesDir) => {
imagesDir.getDirectory("profile", {
create: true
}, onGetDirectorySuccess, onGetDirectoryFail);
}, onGetDirectoryFail);
Bug Report
Hi ! I'm currently unable to make the plugin work properly.
Problem
FileTransfer.download is failing with an error code 1
The weird thing is sometimes work just fine, the same code the same app works fine sometimes gives the error. The weirdest thing is i have another app with the same code it works just fine.
What is expected to happen?
What does actually happen?
When i store the file directly in the app private directory (cordova.file.applicationStorageDirectory + newNam) without trying create sub directories 'images/profile' (cordova.file.applicationStorageDirectory+'images/profile/' + newNam) its work fine
Information
when i tried to create the directory using the file system sometimes create normally in another time can't created and gives error code : 12
i have the WRITE_EXTERNAL_STORAGE permission
even i asking for the permission of the app hasn't
Command or Code
Environment, Platform, Device
Cordova @12 cordova-android@12.0.1 cordova-plugin-file-transfer 2.0.1-dev cordova-plugin-file 8.0.1 android-targetSdkVersion 33
Version information
Checklist