Closed DarkEnigma closed 3 months ago
This issue is stale because it has been open for 7 days with no activity.
Anyone an idea or the time to solve this?
This issue is stale because it has been open for 7 days with no activity.
I am also seeing this issue, where regardless of the path selected the return value using the .save() function is always /storage/emulated/0/Downloads/. interestingly, if you pass through the bytes argument to the save() it does right to an existing file, however it will not if the file size is more than the bytes you are trying to write (i.e. if content was removed from the file)
edit: Opened a separate issue for the second half of this #1569
This issue is stale because it has been open for 7 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
if there is no easy way to solve it, how to use saveFile()
method without dialog? because there is no point in it
Describe the bug When using the saveFile() method of the file picker, the given file data is correctly saved to the device storage, but the returned string path is a completely different one. This way it is not possible to do any additional tasks on the written file (in our case some data validation - other tasks, like save the file path in a local data base for later use, is also possible).
Platform
Platform OS version Android SDK 33 - tested on SUNMI D3 MINI (Real-Device), Emulator iOS ?
How are you picking?
Details to reproduce the issue Use the code above
Flutter Version details Flutter (Channel stable, 3.19.6, on Microsoft Windows [Version 10.0.22631.3880], locale de-DE) • Flutter version 3.19.6 on channel stable at C:\Tools\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 54e66469a9 (3 months ago), 2024-04-17 13:08:03 -0700 • Engine revision c4cd48e186 • Dart version 3.3.4 • DevTools version 2.31.1
Additional context flutter_file_picker v. 8.0.5
As I further investigated the code and the pull request, that added the saveFile() functionality on mobile, it seems that the returned path is constructed using the environment's download directory (line 91) and just adds the file name retrieved from the data uri. But to write the data to the file, the entire uri seems to be used in the outputStream (line 94).
https://github.com/miguelpruivo/flutter_file_picker/blob/5ee480577803a2d1af5a9bd915834d1d6f913f78/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerDelegate.java#L91-L100
As I am relatively new to Flutter (less than a year of experience on this topic) and even less on Android java/kotlin I unfortunately don't know a possible solution. Maybe it is possible to use additional information of the uri in some way to resolve a functioning path. Thanks in advance for the support and thank you for providing this otherwise cool package.