1

I have same page on my website and on mobile app .

on website i use asp.net FileUpload control to upload file to server .

//saving the file
             FileUpload1.SaveAs("<c:\\SaveDirectory>" + FileUpload1.FileName);

on mobile app i am search away to do that and using almost same code on upload file ..

i am using Xamarin.forms

I have object Image contains Image selected or picked and i have file path as following

 public static Image DriverImage;

   DriverImage = new Image();    

   DriverImage .Source = ImageSource.FromStream(() =>
                {
                    var stream = file.GetStream();
                    file.Dispose();
                    return stream;
               });

what i need to do here ?

Mohamad Mahmoud Darwish
  • 3,865
  • 9
  • 51
  • 76

1 Answers1

0

I am unaware of any FilePicker control in Xamarin.Forms. As such you need to create your own FilePicker control in Xamarin Forms.

This is fairly easy, you can just have a list view that shows the folders and when you click on it, it goes into the folders and shows a list of files.

However this will require Dependency Injection to get the list of files and folders.

Xamarin.Android has an example here, you can ignore the UI stuff and just look at the code in retrieving the data

https://developer.xamarin.com/recipes/android/data/files/browse_files/

And for Xamarin.iOS

https://developer.xamarin.com/recipes/ios/general/file_system/enumerate_directories/

Adam
  • 16,089
  • 6
  • 66
  • 109