文件上传,更改弹出窗口中的所有文件? [英] file upload,changing the all files in the popup window?

查看:365
本文介绍了文件上传,更改弹出窗口中的所有文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在文件打开窗口中将deafult文件选择仅限于.pdf文件,而不是 All Files(*。*)。关于如何实现它的任何想法?

示例:




解决方案

只适用于Chrome浏览器,HTML5中新的接受属性:

 < input type =filename =myfileaccept =。pdf/> 



对于跨浏览器支持,您必须为每个浏览器构建浏览器扩展/插件或使用Java / Flash。 $ b

I want to change the deafult file selection limited to .pdf files only instead of All Files(*.*) in the file open window. Any ideas on how to implement it?

Example:

解决方案

This is possible for Chrome only with the new accept attribute of HTML5:

<input type="file" name="myfile" accept=".pdf" />

Live test case.

IE does not and will probably never support that attribute, Firefox supports the attribute but it can only be for image, audio or video files and not PDF.

For cross browser support you will have to build browser extension/plugin for each browser or use Java/Flash.

这篇关于文件上传,更改弹出窗口中的所有文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆