MAUI How to list all files in my phone /storage/emulated/0/Pictures?

xiangnan 21 Reputation points
2022-10-03T13:46:57.577+00:00

I'm planning to develop a net disk app for myself. The first step I need to list all the files in path /storage/emulated/0/Pictures in my phone. I've read the file-picker but no help.

Also, is there any sample maui net disk APP for beginners to learn? Thanks.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,981 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 37,111 Reputation points Microsoft Vendor
    2022-10-04T05:22:30.83+00:00

    Hello,

    It is recommended to use Media picker to pick photos.

    This article describes how you can use the .NET Multi-platform App UI (.NET MAUI) IMediaPicker interface. This interface lets a user pick or take a photo or video on the device.

    Update:

    You could add a Helper class into your Platform\Android folder to get all files from "/storage/emulated/0/Pictures".

       public static class Helper  
       {  
           public static string[] files_help()  
           {  
               var dir = Environment.GetExternalStoragePublicDirectory(Environment.DirectoryPictures);  
               var files = Directory.GetFiles(dir.AbsolutePath, "*");  
               return files  
           }  
       }  
    

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful