Hi experts,
How to upload an image and Video in Single button click ?
Note : No multiselect . Either Photo or Video must be select .
Is that possible in Xamarin forms?
Hi experts,
How to upload an image and Video in Single button click ?
Note : No multiselect . Either Photo or Video must be select .
Is that possible in Xamarin forms?
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.
Hi ,
Here can i compress an Image size
for example I'm uploading an img size => 4MB . While uploading it will compress to <1MB
@JarvanZhang-MSFT can possible
The Xam.Plugin.Media plugin provides the compression option while picking the image.
var file = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
{
PhotoSize = Plugin.Media.Abstractions.PhotoSize.Small,
});
7 people are following this question.