moxiecode / plupload

Plupload is JavaScript API for building file uploaders. It supports multiple file selection, file filtering, chunked upload, client side image downsizing and when necessary can fallback to alternative runtimes, like Flash and Silverlight.
http://www.plupload.com
GNU Affero General Public License v3.0
5.63k stars 1.42k forks source link

Filters are not visible on HTML5 #614

Closed JoaoKunha closed 12 years ago

JoaoKunha commented 12 years ago

Hi

I've been trying to have the "filters" working on HTML5 runtime but it seems to be working only for flash runtime! Tried also in the online examples and I have the same behaviour there. Using Firefox 14.0.1.

The settings I'm using: runtimes: 'html5,flash', max_file_size: '50mb', chunk_size: '1mb', multiple_queues:true, filters : [ {title : "Image files", extensions : "jpg,jpeg,gif,png"}, {title : "Document files", extensions : "pdf,doc,docx,xls,xlsx,ppt,pptx"} ] ...

inghamc commented 12 years ago

Support for HTML5 filters is a browser issue. All Plupload can do (and does) is pass along the filter information, and it's up to the browser to modify the file dialog.

Recent versions of Chrom{e,ium} display "Custom Files" in the filter (ignoring your title) and actually do filter the selection.

Even if the browser-launched file dialog doesn't filter the selectable files, if you listen for plupload.Uploader 'Error' events (using uploader.bind('Error', function(up, error) {...}), you'll find that you will get callbacks when the user selects a file that doesn't meet your criteria -- switch on error.code and check against plupload.FILE_SIZE_ERROR, plupload.FILE_EXTENSION_ERROR, etc.