Bug 190982 - <input type=file accept=...> does not filter correct file types
Summary: <input type=file accept=...> does not filter correct file types
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari 12
Hardware: iPhone / iPad iOS 12
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2018-10-27 06:34 PDT by Khedron wilk
Modified: 2018-10-28 00:19 PDT (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Khedron wilk 2018-10-27 06:34:30 PDT
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.

Expected Results:
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.

Actual Results:
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.

IOS 11.3.1.
IOS 12.0.1

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):
71858  https://bugs.webkit.org/show_bug.cgi?id=71858

This bug earlier reported in radar as:
40394436  https://bugreport.apple.com/web/?problemID=40394436
Comment 1 Khedron wilk 2018-10-28 00:19:26 PDT
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).