Simple cross-platform plug-in that allows you to pick files from the filesystem (iCloud drive in case of iOS) and work with them.
- Available on NuGet: FilePicker Nuget
- Install into your Xamarin.Android, Xamarin.iOS, Xamarin.Forms, Xamarin.Mac project and Client projects.
Platform Support
Platform | Supported | Version | Remarks |
---|---|---|---|
Xamarin.iOS | Yes | iOS 6+ | |
Xamarin.iOS Unified | Yes | iOS 6+ | |
Xamarin.Android | Yes | API 10+ | |
Windows Phone Silverlight | No | ||
Windows Phone RT | Yes | 8.1+ | Up to package version 1.3.x |
Windows Store RT | Yes | 8.1+ | Up to package version 1.3.x |
Windows 10 UWP | Yes | 10+ | |
Xamarin.Mac | Yes | * 10.12+ |
* The Xamarin.Mac implementaiton has only been tested on MacOS 10.12.
Call CrossFilePicker.Current from any platform or .NET Standard project to gain access to APIs.
try
{
FileData fileData = await CrossFilePicker.Current.PickFile();
string fileName = fileData.FileName;
string contents = System.Text.Encoding.UTF8.GetString(fileData.DataArray);
System.Console.WriteLine("File name chosen: " + fileName);
System.Console.WriteLine("File data: " + contents);
}
catch (Exception e)
{
System.Console.WriteLine("Exception choosing file: " + e.ToString());
}
Android:
The WRITE_EXTERNAL_STORAGE
& READ_EXTERNAL_STORAGE
permissions are required.
iOS: Need Configure iCloud Driver for your app
Thanks!
Licensed under main repo license