cordova-plugin-file-transfer
cordova-plugin-file-transfer copied to clipboard
Upload was not working in API level 32 in Android
Getting this error when we are trying to upload a file to server Tried placing android:requestLegacyExternalStorage="true" , but no use
am using Ionic
Please help if any one has solution for this
I have the same problem here. As far as I could find out, it is necessary to set the following access in AndroidManifest.xml:
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
However, Google is very restrictive when it comes to this setting: More information here: https://developer.android.com/training/data-storage/manage-all-files#all-files-access-google-play
In my specific case, I download files for editing. After I edited the file with another app, e.g. Word, I no longer have access to it and I get the same error you described above.
Have you found a solution?
Here is my Output from Logcat:
{"code":1,"source":"file:\/\/\/storage\/emulated\/0\/Documents\/xxx\/xxx\/2110--199705\/file.docx","target":"https:\/\/domain.com\/api\/write","body":"{\"_error\":{\"1\":{\"hl\":\"xxx \\\/ ApiService\",\"eMsg\":\"Funktion 'xxxxx' yyyyy.\",\"addInfo\":\"\",\"icon\":\"48\",\"Type\":6,\"errNo\":131045,\"Modul\":\"ApiService\",\"PID\":3404,\"Computer\":\"XXX\"}}}","http_status":400,"exception":"\/storage\/emulated\/0\/Documents\/xxx\/xxx\/2110--199705\/file.docx: open failed: EACCES (Permission denied)"} java.io.FileNotFoundException: /storage/emulated/0/Documents/xxx/xxx/2110--199705/file.docx: open failed: EACCES (Permission denied) at libcore.io.IoBridge.open(IoBridge.java:575) at java.io.FileInputStream.<init>(FileInputStream.java:160) at java.io.FileInputStream.<init>(FileInputStream.java:115) at org.apache.cordova.CordovaResourceApi.openForRead(CordovaResourceApi.java:249) at org.apache.cordova.CordovaResourceApi.openForRead(CordovaResourceApi.java:232) at org.apache.cordova.filetransfer.FileTransfer$1.run(FileTransfer.java:395) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:920) Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied) at libcore.io.Linux.open(Native Method) at libcore.io.ForwardingOs.open(ForwardingOs.java:567) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:273) at libcore.io.ForwardingOs.open(ForwardingOs.java:567) at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8442) at libcore.io.IoBridge.open(IoBridge.java:561) at java.io.FileInputStream.<init>(FileInputStream.java:160) at java.io.FileInputStream.<init>(FileInputStream.java:115) at org.apache.cordova.CordovaResourceApi.openForRead(CordovaResourceApi.java:249) at org.apache.cordova.CordovaResourceApi.openForRead(CordovaResourceApi.java:232) at org.apache.cordova.filetransfer.FileTransfer$1.run(FileTransfer.java:395) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:920)
For anyone still needing a solution, see this post:
https://github.com/apache/cordova-plugin-file-transfer/issues/339#issuecomment-1450747708