Search code examples
flutteramazon-s3uploadfile-extensionfilepicker

What are the common image/video file extensions for Android and IoS to be granted to user?


I am writing a Flutter application that needs user to upload some image and video files. I use the following code for that:

              FilePickerResult? result =
                  await FilePicker.platform.pickFiles(
                allowMultiple: false,
                allowedExtensions: ['jpg', 'png'],
              );

              FilePickerResult? result =
                  await FilePicker.platform.pickFiles(
                allowMultiple: false,
                allowedExtensions: ['mp4', 'avi'],
              );

But I don't know what type of files should I specify in file_picker's AllowedExtensions property?

My concern is about the specific file extensions that may a device model uses to store images/videos?

How can I deal with this? Is there an option for file_picker to say allow images/videos in any format?( Although I am not sure about this as well and maybe I should put some restriction about the file formats I go to save on S3 as my application uses S3 for storage).


Solution

  • Use the type parameter instead:

    await FilePicker.platform.pickFiles(type: FileType.video)
    

    See the docs