Code Monkey home page Code Monkey logo

Comments (40)

miguelpruivo avatar miguelpruivo commented on May 31, 2024 8

Anyway, when I have some time I’ll take a further look into it and see what I can do, if possible with custom MIME/UTI. For that matter I’ll leave this issue opened. As of now it will stick as it is for a while.

Thank you for the suggestion and happy new year!

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024 3

Hi. I understand what you’re trying to achieve, but for that a custom File Provider and explorer would probably be needed, which isn’t actually the purpose of this plugin.

This is intended to use the native explorers with filters for the supported MIME types on Android or UTI’s on iOS.

If the file you want to open is not supported, you can always choose ALL which will display all the files without filtering and validate it yourself within the app (e.g. if the returned file doesn’t match the required extension show a warning and open picker again).

from flutter_file_picker.

karnadii avatar karnadii commented on May 31, 2024 2

@miguelpruivo i have ,

 [FilePicker] Platform exception: PlatformException(FilePicker, Unsupported filter. Make sure that you are only using the extension without the dot, (ie., jpg
instead of .jpg). This could also have happened because you are using an unsupported file extension.  If the problem persists, you may want to consider using FileType.ALL instead., null)

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024 2

@jamesmoore255 I got have to have some time to implement it, I can't really tell. Can be this week, can be this month... 😞 But it's definitely the next feature to add to this plugin.

Sorry for taking a while.

from flutter_file_picker.

romathebest avatar romathebest commented on May 31, 2024 2

@miguelpruivo I am trying to show only .db files with SQLite data. Android 10 - Samsung s9 sm g960f

from flutter_file_picker.

romathebest avatar romathebest commented on May 31, 2024 2

@Adem68 it's not working for a while, this issue opened more then a year ago
Right now you can use only FileType.any for files with your custom extensions

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024 2

@Aravin that’s just a platform bottleneck. There’s no definite fix that can be applied here other than creating a custom explorer from scratch which wasn’t the intended behavior from the plugin since the beginning.

I’m sorry for any inconvenience.

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024 1

@karnadii you should be able to pick json extension by doing:

FilePicker.getFilePath(type: FileType.CUSTOM, fileExtension: 'json’);

Have you already tried?

from flutter_file_picker.

karnadii avatar karnadii commented on May 31, 2024 1

I dont have iOS so I can only confirm for android

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024 1

Right. I’ll take a look into it whenever I got some time. Thank you @karnadii.

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024 1

@Adem68 you need to use FileType.any and don't specify an extension at all. That's on the Wiki.

from flutter_file_picker.

DebugTheCode avatar DebugTheCode commented on May 31, 2024 1

@miguelpruivo I agree. That's why I warned for the possible overkill.

from flutter_file_picker.

 avatar commented on May 31, 2024 1

just write this
a

from flutter_file_picker.

kinex avatar kinex commented on May 31, 2024

OK I understand. I think I can live with this limitation, I will use ALL as you suggested.

from flutter_file_picker.

kinex avatar kinex commented on May 31, 2024

Great, thanks! Happy new year to you too!

from flutter_file_picker.

karnadii avatar karnadii commented on May 31, 2024

+1 I need to pick .json file too

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024

@karnadii, that’s weird because json is actually a supported content file type. Is this happening on iOS, Android, or both? Can you check that?

Nevertheless, with FileType.ALL you are able to pick it, right?

Thank you.

from flutter_file_picker.

karnadii avatar karnadii commented on May 31, 2024

@miguelpruivo using android, yes i use FileType.ALL and then validate it within the app

from flutter_file_picker.

pcg92 avatar pcg92 commented on May 31, 2024

Maybe the filetype should be an array of files types.

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024

@pcegarra yes, that’s one of the upcoming requested features.

from flutter_file_picker.

jamesmoore255 avatar jamesmoore255 commented on May 31, 2024

@miguelpruivo when do you think the array of file types will be supported?

from flutter_file_picker.

jamesmoore255 avatar jamesmoore255 commented on May 31, 2024

No problems @miguelpruivo, I'll keep an eye out for when it is finished!

from flutter_file_picker.

Zeeshan0201 avatar Zeeshan0201 commented on May 31, 2024

@miguelpruivo it's implemented(array of file types ) or still remaining?

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024

It’s on the todo list @Zeeshan0201

from flutter_file_picker.

Zeeshan0201 avatar Zeeshan0201 commented on May 31, 2024

@miguelpruivo okay, please let us know when it's completed.thanks in advance.

from flutter_file_picker.

FineTillYouCameAlong avatar FineTillYouCameAlong commented on May 31, 2024

Will I be expected to provide all purpose strings on iOS if I use FileType.ALL? My app is using FileType.ALL (because of unsupported extensions) and when I tried to upload my binary to the App Store, it got rejected because it was missing the NSPhotoLibraryUsageDescription purpose string in Info.plist.
I don't know where/how these purpose strings show up (because I've been using the app only on my test device where everything goes) but it would be a significant disadvantage to using FileType.ALL as a workaround for unsupported extensions.

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024

@FineTillYouCameAlong you are using a package that allows you to access the gallery thus you need to provide the proper entitlements for that because Apple doesn’t know if you’ll actually be picking files from it.

That will happen with every package that uses any kind of functionality, however, the user won’t be notified or allow those permissions unless you explicitly use it on your app.

from flutter_file_picker.

Laban1 avatar Laban1 commented on May 31, 2024

I am having a similar issue, but unable to use the FilePicker at all (Android emulator).

First I tried:

var path = FilePicker.getFilePath(type: FileType.CUSTOM, fileExtension: 'json’);

"Unsupported filter. Make sure that you are only using the extension without the dot, (ie., jpg instead of .jpg). This could also have happened because you are using an unsupported file extension. If the problem persists, you may want to consider using FileType.ALL instead."

var path = await FilePicker.getFilePath(type: FileType.ANY);

"No implementation found for method ANY on channel file_picker"

What I really need is to prompt the user to pick a json file from a folder under getExternalStorageDirectory().path:

var backupPath = join((await getExternalStorageDirectory()).path, 'archive');

I just saw that specifying a folder is not currently supported (in #99), which is too bad - it would be extremely useful.

from flutter_file_picker.

romathebest avatar romathebest commented on May 31, 2024

hi, any news about the fix? I still have this issue on version 1.5.0+2

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024

@romathebest not yet, there are a couple of things on the line to be made, however, this plugin uses the supported UTI's, I'm not quite sure why it wouldn't support some files. Which type are you trying and in which platform/device? Thank you.

from flutter_file_picker.

Adem68 avatar Adem68 commented on May 31, 2024

I'm using 1.5.1 version. I can't show only kml and gpx files with custom parameter.

FilePicker.getFilePath(type: FileType.custom, fileExtension: 'gpx');
FilePicker.getFilePath(type: FileType.custom, fileExtension: 'kml');

Library gives platform exception;

Platform exception: PlatformException(Unsupported file extension, Make sure that you are only using the extension without the dot, (ie., jpg instead of .jpg). This could also have happened because you are using an unsupported file extension. If the problem persists, you may want to consider using FileType.ALL instead., null)

I was using any parameter in old version and it's was working.

FilePicker.getFilePath(type: FileType.any, fileExtension: 'gpx');
FilePicker.getFilePath(type: FileType.any, fileExtension: 'kml');

Should may i downgrade version?

from flutter_file_picker.

Adem68 avatar Adem68 commented on May 31, 2024

Thx for reply @romathebest i tried with FileType.any then not worked.

from flutter_file_picker.

romathebest avatar romathebest commented on May 31, 2024

@miguelpruivo I have checked code. There is getMimeTypeFromExtension() on android and it has limited extensions support. It changed in each version of android. For example, you can check list for android 7

I think there should be work around not to use it and set extensions manually

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024

@romathebest sure, that's what this issue is all about, actually.

from flutter_file_picker.

DebugTheCode avatar DebugTheCode commented on May 31, 2024

As a suggestion, if you want to manually check what codec a file is, you can use the ffmpeg library (https://pub.dev/packages/flutter_ffmpeg). For some things it may be an overkill to use it, but it's very reliable.

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024

@DebugTheCode I'm familiar with ffmpeg, however, it's an heavy package to be bundled with and also has restrictions on minor iOS version for Flutter (I believe iOS 11). I think that it should be up to the user to use whatever he wants because some may want to add compression, check codecs and so on while others don't.

from flutter_file_picker.

wreyford avatar wreyford commented on May 31, 2024

@miguelpruivo I have checked code. There is getMimeTypeFromExtension() on android and it has limited extensions support. It changed in each version of android. For example, you can check list for android 7

I think there should be work around not to use it and set extensions manually

I looked at the link supplied, and on line 314 the 'csv' type is an included mime type, yet your file picker refuses to see the *.csv extension when used with custom.
314 add("text/comma-separated-values", "csv");
I need to limit users to the correct file type. What's the use of a file picker with extensions if they appear greyed out. Changing the extension of the file to .xls makes it visible to the file picker if .xls is used as the extension, but remains greyed if csv. Why can this not be fixed on your side.

from flutter_file_picker.

miguelpruivo avatar miguelpruivo commented on May 31, 2024

@wreyford the plugin just acts as a bridge between Flutter and iOS/Android by launching their own pickers with a few parameters one of which is the file type filter. Thing is, some Androids will honor those filters whereas others don't, you can read moer about it here.

Think of the filtering as a nice to have but you should always validate on your side, thus, discarding all unsupported files. I can't by any means force whatever file explorer will launch with the picker, to accept/refuse those filters, because some users even have 3rd party explores such as ESExplorer that can be used along with file picker.

from flutter_file_picker.

Aravin avatar Aravin commented on May 31, 2024

There is no fix for this bug, but it was closed ?

from flutter_file_picker.

charismatest avatar charismatest commented on May 31, 2024

I am trying to filter 'bin' (application/octet-stream), but get this error. I tried a few other extensions like 'jpg' and 'pdf' and they seem to work. I don't quite understand which MIME types are currently supported, would be nice to have a list or something.

edit: As the wiki states: it seems to be platform dependend. When i use the emulator, filtering works.

from flutter_file_picker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.