1

i have developed to pick file form mobile, but need to pickup multpple file here is my code

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());
        }

need to know how i can select multiple files

waqas waqas
  • 197
  • 9
  • 22
  • Which type of file you want to pick,such as image,doc,or video? – Junior Jiang Feb 06 '19 at 03:37
  • i need for both can be image or document, no video – waqas waqas Feb 06 '19 at 05:11
  • There is no direct way to select multiple files.Suggest that trying native ways to do.If select images you can try these ways.https://stackoverflow.com/questions/33750101/how-to-select-multiple-images-from-gallery-for-android-and-ios-device-using-xama and https://forums.xamarin.com/discussion/127427/select-multiple-image-from-gallery-in-ios.Docs can refer to this.https://stackoverflow.com/questions/19513556/select-multiple-files-with-intent-action-get-content However ios have less samples to select multi files. – Junior Jiang Feb 06 '19 at 07:19

1 Answers1

1

You can use Xamarin Essentials FilePicker to select multiple files.It is stable now and support Android,iOS and UWP.

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

bhavya joshi
  • 1,096
  • 10
  • 20