Not possible to specify correct file filter for file open dialog initated in a webpage view on webbrowser on IOS.
The attribute ACCEPT on the HTML element INPUT with TYPE= ”file” is in IOS seems to not be interpreted according to official HTML standard as defined by W3C:
Fo reference, please see:
Steps to Reproduce:
1. Create a webpage that may produce a file dialog, like this example:
<form action="nopage.html" method="post" enctype="multipart/form-data">
<input type="file" accept="image/png,image/jpeg,application/pdf">
<input type="submit" name="submit" value="Submit">
2. View the webpage built on this, or similar, code in a web browser on IOS.
3. Open the file dialog.
When the file dialog windows is used to browse a file directory containing files of different types, all files of the types PNG, JPG and PDF should be selectable. No other file types should be selectable.
Expected results in general is that selectable file types in a file dialog open from a webpage in this way should be according to the type specified in the accept attribute of the input element with type=file.
When the file dialog windows is used to browse a file directory containing files of different types, only files of the types PNG ang JPG is selectable.
Actual results in general is that the accept attribute, of the input element with type=file, does not result in the correct file types being selectable.
Alternative actual results is that some combinations of types specified in accept attribute will result in alla files being selectable.
Mobile Safari on iPhone 7 (model MN952QB/A).
Mobile Safari on iPad Pro 10 inch (model MQF22KN/A).
Firefox Focus on iPhone 7
Firefox Focus on iPad Pro 10 inch.
Possible related bugs (but not the same description/reasoning):
This bug earlier reported in radar as:
1. My earlier tests seems to show that *no* other MIME-types than image/* works? No variant of application/ or other MIME-group seem to work. "Work" in this case = affect what files being selectable. "Earlier" in this case = IOS 11.x - I have not retested this specifically under IOS 12.x.
2. Personal speculation: I get association to the time before the Apple File-app was part of IOS. Before that you could only upload images. This looks to be some kind of remains of that time?
3. Since I am not a WebKit-developer I am not 100% sure whether this is a WebKit-bug or a IOS-bug. My apology if I am in error.
4. I am of course available as test user for any sort of testing related to this reported bug.
5. Real world consequences of this bug:
There is web applications that a user today can not use in full on IOS. For security reasons an application may specify a narrow set of file types that are allowed to be uploaded to server. But since the accept-definition seems to not work correctly in WebKit/IOS the user are not able to upload some files that are needed for using the system. I.e. user have to interrupt their workflow on an iPhone/iPad to do some of the work on a traditional computer (laptop/desktop).
I believe I've run into the same issue. Here is a reproducible test case: http://bl.ocks.org/nolanlawson/raw/6fe0456c4b3996e69bbd1c2f11920d76/
On iOS 12.4, using <input type="file">, I see the following behavior:
accept="audio/*" correctly allows m4a audio files to be selected
accept="audio/*,image/*" does NOT allow m4a audio files to be selected
accept="*/*" allows m4a audio files to be selected
Steps to reproduce:
1. In the Voice Memos app, create a voice memo (m4a file) and save it to iCloud
2. Navigate to the above website in Safari
3. Click the "allows both audio and images" input
4. Under iCloud, try to choose the file
The m4a file is not grayed out and is selectable.
The m4a file is grayed out and not selectable.
(In reply to Nolan Lawson from comment #2)
> I believe I've run into the same issue. Here is a reproducible test case:
> On iOS 12.4, using <input type="file">, I see the following behavior:
> accept="audio/*" correctly allows m4a audio files to be selected
> accept="audio/*,image/*" does NOT allow m4a audio files to be selected
> accept="*/*" allows m4a audio files to be selected
> Steps to reproduce:
> 1. In the Voice Memos app, create a voice memo (m4a file) and save it to
> 2. Navigate to the above website in Safari
> 3. Click the "allows both audio and images" input
> 4. Under iCloud, try to choose the file
> Expected results:
> The m4a file is not grayed out and is selectable.
> Actual results:
> The m4a file is grayed out and not selectable.
I feel like I fixed this in iOS 13, could someone please try the beta?
Based on user reports (https://toot.cafe/@nolan/1029205644019006040) this is indeed fixed in iOS 13! :)
Seems indeed to be solved in iOS 13.
So I close this bug.
(In reply to Khedron wilk from comment #5)
> Seems indeed to be solved in iOS 13.
> So I close this bug.
Thanks for confirming.