此页面的以下代码片段不过滤GoogleChrome中的文件类型,但似乎可以过滤Mozilla和Internet Explorer中的文件类型。它使用的PLUADI API。过滤器在Internet Explorer和Mozilla Firefox中显示“我的文件类型”,但在GoogleChrome中显示“自定义文件”。谷歌浏览器的文件上传对话框有什么不同?我怎么能解决这个问题与plader?我的解决方法是完全删除“过滤器”,或者在谷歌Chrome中将“类型文件”下拉选项从“自定义文件”更改为“所有文件”。
http://www.west-wind.com/weblog/posts/2013/Mar/12/Using-plUpload-to-upload-Files-with-ASPNET
.... 单击“GitHub上本文的源代码”下载源代码。我修改了一些东西。
代码:
$("#Uploader").pluploadQueue({
runtimes: 'html5,silverlight,flash,html4',
url: 'UploadHandler.ashx',
max_file_size: '2mb',
chunk_size: '64kb',
unique_names: false,
filters: [{ title: "My File Types", extensions: "xlsx,xls,docx,doc"}],
flash_swf_url: 'scripts/plupload/plupload.flash.swf',
silverlight_xap_url: 'scripts/plupload/plupload.silverlight.xap',
multiple_queues: true
});
这可能是由于您正在使用的运行时。由于您指定了安装'html5, silverlight, flash, html4'
,所以HTML5运行时在可用时首先使用(Chrome必须如此)。这个运行时是罪魁祸首。
如果文件扩展名对您来说是一个严重的问题,您可以优先使用Flash或SilverLight:'SilverLight,Flash,html5,html4'
。HTML5仍然可以使用,但前提是SilverLight和Flash都不可用。