Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

[Enhancement] Add SaveAsync method to FilePicker class

Open djordje200179 opened this issue 5 years ago • 5 comments

Summary

I think that it would be nice if we could show a picker using which a user could save a file. It would behave like FileSavePicker in Windows/UWP.

API Changes

Add public static async Task<FileResult> SaveAsync(SaveOptions options = null); method to FilePicker class.

Intended Use Case

This functionality could be used when developers want to give a user ability to save a file (or an image), that was created in an app, in any folder that the user wants.

djordje200179 avatar Sep 17 '20 18:09 djordje200179

Just want to check... How does this differ from a share? Is this basically putting the file onto the filesystem and never going to a new app?

mattleibow avatar Sep 30 '20 19:09 mattleibow

If you have an app that edits images or creates documents, and latter the user wants to save the file to internal storage.

djordje200179 avatar Sep 30 '20 19:09 djordje200179

I think it is responsibility of the fileSystem: https://github.com/xamarin/Essentials/issues/1006

VladislavAntonyuk avatar Oct 16 '20 15:10 VladislavAntonyuk

Putting it in the FileSystem API could cause some confusion. I see the FileSystem API being enhanced to allow for saving files within the scope of the app (sandbox, permitted folders) whereas saving a file out of the app's scope (to an external location on the device, or to the cloud) seems to be a separate concern. I like the semantics in UWP for this. They call it FileSavePicker (under Windows.Storage.Pickers). Or if that is too fine-grained, it could be an enhancement to the FilePicker API as suggested by @djordje200179.

1Cor125 avatar Oct 27 '20 00:10 1Cor125

Just want to check... How does this differ from a share? Is this basically putting the file onto the filesystem and never going to a new app?

It differs this way, user sometimes just want to save something outside app without opening it (backup with possibility to share file later). Additionally, I meet androids where sharing doesn't allow saving JSON files on disk.

MikDal002 avatar Jan 22 '22 23:01 MikDal002

Any update on this? Seems to be a pretty simple change. Change the 'Open' button to say 'Save', then remove the check for a valid file when you click the button. Just need the file path. It's up to the developer to determine how the file is saved.

MuzzyA avatar Oct 05 '22 13:10 MuzzyA

I think at this point it's safe to say that this won't be making it's way into Xamarin.Essentials anymore. Keep your eye on .NET MAUI for all new development! Thanks for all input and efforts here.

There is now a FileSave API in the .NET MAUI Community Toolkit available that allows you to save files!

jfversluis avatar Aug 18 '23 08:08 jfversluis