Simple cross-platform plug-in that allows you to pick files and work with them.
The original project can be found here, but seems abandoned, this one was forked and further developed.
NuGet: https://www.nuget.org/packages/Xamarin.Plugin.FilePicker/
Add this as a source to your IDE to find the latest packages: https://ci.appveyor.com/nuget/filepicker-plugin-for-xamarin
- 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.4.x |
Windows Store RT | Yes | 8.1+ | Up to package version 1.4.x |
Windows 10 UWP | Yes | 10+ | |
Xamarin.Mac | Yes | * 10.12+ |
* The Xamarin.Mac implementation 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();
if (fileData == null)
return; // user canceled file picking
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 ex)
{
System.Console.WriteLine("Exception choosing file: " + ex.ToString());
}
Android:
The WRITE_EXTERNAL_STORAGE
& READ_EXTERNAL_STORAGE
permissions are required.
iOS: Need Configure iCloud Driver for your app
- jfversluis
- rafaelrmou (original author)
- vividos
Thanks!