Minimus Heximus
Minimus Heximus

Reputation: 2815

Xamarin.Essentials; FilePicker; Save a new file

Using FilePicker one can open an existing file:

         FileResult file = await FilePicker.PickAsync();
         TextView textview = FindViewById<TextView>(Resource.Id.textview);
         string path = file.FullPath;
         var handle = File.Open(path, FileMode.OpenOrCreate);
         byte[] data = new byte[10];
         handle.Read(data, 0, 10);

Is there a similar way for saving a new file?

Upvotes: 0

Views: 3062

Answers (1)

Wendy Zang - MSFT
Wendy Zang - MSFT

Reputation: 10958

For now, the FilePicker plugin is only designed to pick existing files.

On Android and iOS, you could not do that. But on UWP, you could use the FileSavePicker.

Xamarin: https://learn.microsoft.com/en-us/xamarin/essentials/file-picker?tabs=android

UWP: https://learn.microsoft.com/en-us/windows/uwp/files/quickstart-save-a-file-with-a-picker

Upvotes: 1

Related Questions