Open julianadormon opened 2 years ago
If I remove the options, I have no problem selecting a csv file, so it CAN pick the right file. Something is not right with the options definition.
Furthermore, if I use the default, FilePickerFileType.Images, as a test
PickOptions options = new() { PickerTitle = "Please select a csv file", FileTypes = FilePickerFileType.Images };
This results in the same error.
As does var file = await FilePicker.Default.PickAsync(PickOptions.Images);
Having the same problem on MacOS as well.
`
var pickOptions = new PickOptions()
{
FileTypes = new FilePickerFileType(new Dictionary<DevicePlatform, IEnumerable
var result = await FilePicker.Default.PickAsync(pickOptions); if (result != null) { // do something } `
Leaving the file type out in pick option do work as a workaround explained above, but no filtering support.
Same problem here on MacOS. The workaround allows the pick to work without the filtering. I have tested this on Windows and Android and the filtering works.
I found that if I use MacCatalyst instead of MacOS it works fine:
var zipFileType = new FilePickerFileType(new Dictionary<DevicePlatform, IEnumerable<string>>
{
{ DevicePlatform.iOS, new[] { "public.archive" } },
{ DevicePlatform.Android, new[] { "application/zip" } },
{ DevicePlatform.WinUI, new[] { "zip" } },
{ DevicePlatform.MacCatalyst, new[] { "zip" } },
});
var optionsZip = new PickOptions
{
PickerTitle = "Please select a previously backed up zip file",
FileTypes = zipFileType
};
@cdavidyoung Thank you so much for figuring this out!
Providing supported file type options disables all those files in File Browser in Android. So, I am unable to pick those files. If I do not mention any file types (filePicker.PickAsync(null)) , it woks good, but shows all files.
I want to restrict to show only supported files to pick Ex. png, jpg, pdf.
Can repro the issue.
This is really annoying and needs to be fixed!
FYI: Using "MacCatalyst" is the right thing here. "MacOS" refers to AppKit macOS applications, which MAUI Essentials can use.
Also redirecting https://github.com/dotnet/maui/issues/13294 here, since it seems like they are general issues around the API here and getting it to work.
@mattleibow I'm not sure if the Android issue here is a bug, or the API being incorrectly used.
Verified this issue with VSM 17.6.7 (build 417). Can repro this issue.
Hey, I'm still getting this issue as well.
Issue https://github.com/dotnet/maui/issues/13294 was marked as a duplicate of this one. However #13294 is Android specific. I'm trying to get "text/csv" to work for the Android platform so the users can upload a .csv file.
If #13294 is being redirected, maybe add the platform/Android tag?
I'll see if I can dig up the list of supported mime types for the native Android file picker control and reference it here. If Google's API doesn't support it, not sure what can be done at the MAUI layer.
I'm trying to do the same as @SonicScholar i.e. allow picking of .csv files only, but all files are non selectable
var customFiletype =
new FilePickerFileType(new Dictionary<DevicePlatform, IEnumerable<string>>
{
{ DevicePlatform.Android, new[] {"csv"} }
});
var options = new PickOptions
{
PickerTitle = "Please select a CSV file",
FileTypes = customFiletype
};
Same problem here, i'm trying to filter on csv files or on .dat file and they are unselectable (tested on android)
Description
I am building a desktop app in .NET Maui which targets Windows and MacOS. When using the built-in FilePicker on Mac (Catalyst) I get the following error:
{System.PlatformNotSupportedException: This platform does not support this file type. at Microsoft.Maui.Storage.FilePickerFileType.GetPlatformFileType(DevicePlatform platform) at Microsoft.Maui.Storage.FilePickerFileType.get_Value() at Microsoft.Maui.S…}
I have tried multiple file types, including csv, jpg, text/csv but nothing works.
`public async Task ImportCSV() { try { var customFileType = new FilePickerFileType( new Dictionary<DevicePlatform, IEnumerable>
{
{ DevicePlatform.WinUI, new[] { ".csv" } },
{ DevicePlatform.macOS, new[] {"csv"} }
});
Steps to Reproduce
Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
macOS
Affected platform versions
MacCatalyst 14.0
Did you find any workaround?
The documentation does say that I should "Enable iCloud capabilities" but does not provide any links or other information regarding this. I did some digging, and found some documentation that says that it necessary to do this via the Entitlements.plist file which I did but it seems to only be relevant when publishing your app to the App store which I am not during development. I don't even care about iCloud right now. I just want to select a CSV file from my own desktop.
Relevant log output