Reviewing Wordpress's media upload functionality, I see that the support the 'accept' attribute which means that native file open browsers can limit what files can be selected, which is really nice:

<input id="p16vjbnqv1168h1n7g1vpb1kk413ff0_html5" style="font-size: 999px; position: absolute; width: 100%; height: 100%; " type="file" accept="image/jpeg,image/png,image/gif,application/pdf,application/msword,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.presentationml.slideshow,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" multiple="multiple">

Since we would have a list of allowed extensions, we should add an API function to convert an array of extensions to an array of attributes, and then do $form['upload']['#attributes']['accept'] = implode(',', $mimetypes);

Files: 
CommentFileSizeAuthor
#2 1632664-file-accept-attributes.patch5.27 KBDave Reid
FAILED: [[SimpleTest]]: [MySQL] 118 pass(es), 2 fail(s), and 0 exception(s).
[ View ]

Comments

Dave Reid’s picture

Assigned:Unassigned» Dave Reid

Working on a patch today.

Dave Reid’s picture

Assigned:Dave Reid» Unassigned
StatusFileSize
new5.27 KB
FAILED: [[SimpleTest]]: [MySQL] 118 pass(es), 2 fail(s), and 0 exception(s).
[ View ]

Initial patch that I've been working on.

Dave Reid’s picture

Status:Active» Needs review

The last submitted patch, 1632664-file-accept-attributes.patch, failed testing.

Dave Reid’s picture

Assigned:Unassigned» Dave Reid
Issue summary:View changes
Dave Reid’s picture