Comments (40)
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.
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.
@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.
@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.
@miguelpruivo I am trying to show only .db files with SQLite data. Android 10 - Samsung s9 sm g960f
from flutter_file_picker.
@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.
@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.
@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.
I dont have iOS so I can only confirm for android
from flutter_file_picker.
Right. I’ll take a look into it whenever I got some time. Thank you @karnadii.
from flutter_file_picker.
@Adem68 you need to use FileType.any
and don't specify an extension at all. That's on the Wiki.
from flutter_file_picker.
@miguelpruivo I agree. That's why I warned for the possible overkill.
from flutter_file_picker.
from flutter_file_picker.
OK I understand. I think I can live with this limitation, I will use ALL as you suggested.
from flutter_file_picker.
Great, thanks! Happy new year to you too!
from flutter_file_picker.
+1 I need to pick .json file too
from flutter_file_picker.
@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.
@miguelpruivo using android, yes i use FileType.ALL
and then validate it within the app
from flutter_file_picker.
Maybe the filetype should be an array of files types.
from flutter_file_picker.
@pcegarra yes, that’s one of the upcoming requested features.
from flutter_file_picker.
@miguelpruivo when do you think the array of file types will be supported?
from flutter_file_picker.
No problems @miguelpruivo, I'll keep an eye out for when it is finished!
from flutter_file_picker.
@miguelpruivo it's implemented(array of file types ) or still remaining?
from flutter_file_picker.
It’s on the todo list @Zeeshan0201
from flutter_file_picker.
@miguelpruivo okay, please let us know when it's completed.thanks in advance.
from flutter_file_picker.
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.
@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.
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.
hi, any news about the fix? I still have this issue on version 1.5.0+2
from flutter_file_picker.
@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.
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.
Thx for reply @romathebest i tried with FileType.any then not worked.
from flutter_file_picker.
@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.
@romathebest sure, that's what this issue is all about, actually.
from flutter_file_picker.
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.
@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.
@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.
@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.
There is no fix for this bug, but it was closed ?
from flutter_file_picker.
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)
- Reimplement linux file picker using native APIs in the app rather than calling out to zenity
- Changes 'dart:html' to 'universal:html' HOT 1
- [iOS] Hide DRM protected files for Apple Music picker HOT 2
- Feature request: add an option parameter to return the original path and avoid caching the file (for Android/iOS). HOT 2
- The application closes when selecting an image HOT 1
- Property with 'retain (or strong)' attribute must be of object type HOT 5
- Update regarding DKImagePickerController/PhotoGallery of Privacy Manifest? HOT 5
- type 'NativeByteBuffer' is not a subtype of type 'List<int>' HOT 5
- After drag and drop image when trying select image to upload there is no way handle selected image HOT 2
- The path returned by FilePicker.platform.saveFile does not exist on ios HOT 3
- Not work `clearTemporaryFiles()` on Android HOT 3
- getDirectoryPath() not working on Android 8/9 HOT 1
- The `initialDirectory` parameter of `getDirectoryPath` does not support POSIX-style paths HOT 1
- Bug: file explorer dialog displayed at the top of the screen on iOS mobile (web) HOT 1
- `saveFile` with `initialDirectory` fails silently HOT 1
- Images in README.md on pub.dev are not loading HOT 1
- Please add API to return the real file names besides cached file names HOT 1
- Flutter web wasm HOT 1
- Google rejects this picker library HOT 2
- File picker loses info when importing Android pictures (rotation + quality) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_file_picker.