feat: More restrictive MIME types for better UX uploading images from Android #844
Labels
✨ enhancement
suggestion or feature request to improve uploadthing
haunted
things that will likely be difficult to test / find root causes on
🙋♂️ help wanted
Describe the feature you'd like to request
The UploadButton component creates a
<input type="file">
which includes everyimage/*
MIME in it'saccept=""
, apparently because some OSes don't want to useimage/*
. Some of these mime types, causes Android to opt out of their "Cloud media app" flow, and instead of showing all images from your google Photos, to select a file instead.I tested a small thing https://image-mime-types.vercel.app/ and it seems like all MIME types with a period in them, triggers the file selection flow intead of the cloud media flow. Which honestly sounds like a bug in Android, but you know.
I was thinking how to work around this? Do I create add one config entry for each MIME I want to support? I also tried having the key in my FileRouter to be all mime types comma separated, which builds and creates a Upload button that's correct, but API gets sad when I upload.
I also was considering writing my own component so that I can specify a more restrictive "accepts" while using the "image" file route config.
But either way, I feel like the "out of the box" experience of uploadthing should be as smooth as possible? If you create upload of images, it shoul go into the image gallery path rather than "find a file on your phone".
Describe the solution you'd like to see
I think "UploadButton" component could recieve configuration to allow us to modify the
accepts
, but I also think that the default when usingimage
in your File route, should exlcude all image types with periods in them. But if UploadThing don't want to build a work-around for an android/chrome bug(?) I also think that's fair.Additional information
I've been trying to find information about what rules trigger the "Cloud media app" on android, but I honestly can't find any.. It's a case of unfortunate mix of buzz words...
👨👧👦 Contributing
The text was updated successfully, but these errors were encountered: