Hello,
Welcome to our Microsoft Q&A platform!
How to upload an image and Video in Single button click ?
It supports to upload an image or a video. For this function, you could just use Xamarin.Essentials.FilePicker
like below.
var options = new PickOptions
{
PickerTitle = "Please select a comic file",
FileTypes = FilePickerFileType.Images//or FileTypes = FilePickerFileType.Videos
};
var result = await FilePicker.PickAsync(options);
But we cannot list both the videos and images to picker one from them. It only support to set one file type at one time when picking the file. Even when using a customFileType, it will only list the files of one type.
var customFileType =
new FilePickerFileType(new Dictionary<DevicePlatform, IEnumerable<string>>
{
{ DevicePlatform.Android, new[] { "image/*","video/*" } },
{ DevicePlatform.iOS, new[] { "public.image" } }
});
var options = new PickOptions
{
PickerTitle = "Please select a comic file",
FileTypes = customFileType
};
var result = await FilePicker.PickAsync(options);
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
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.