如何筛选哪些文件可以在上传对话框中可以看到? [英] How to filter which files can be seen on upload dialog box?

查看:176
本文介绍了如何筛选哪些文件可以在上传对话框中可以看到?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个ASP.NET MVC应用程序,它是不是有像ActiveXes,Flash或Java小程序(JavaScript是OK)客户端对象,它是可行的,想象它是可能的,当上载文件对话框弹出,它将只显示文件我指定?

In an ASP.NET MVC application which is not to have client side objects like ActiveXes, Flash or Java Applets (JavaScript is OK), is it feasible to imagine it being possible that when an upload file dialog box pops up, it will only show the files I specify?

例如,唯一的扩展.DOCX或DOCX和JPG档案将是可见和可选,在打开文件一样对话框中选择要上传的文件。

For example, only files of extension .docx or docx and jpg would be visible and selectable on the open-file-like dialog box for selecting a file to upload..

我已阅读,有一个带有此功能的浏览器支持的问题,但它是应该用正确的设置工作?

I have read that there is an issue with browser support for this functionality, although it is something that should work with the right settings?

如果我能得到一些例子,有的抬起头这一点,那将是巨大的。

If I could get some examples and some heads up on this, it would be great.

请问AjaxControlKit是东西,将支持此功能?

Would the AjaxControlKit be something that would support this functionality?

谢谢,

里克

推荐答案

input元素支持一个接受以现代浏览器如Chrome支持的属性:

The input element supports an accept attribute which is supported by modern browsers like Chrome:

<input id="file" type="file" name="file" size="30" 
accept="image/jpg,image/png,image/jpeg,image/gif">

可悲的是这是不支持IE,甚至没有IE9。

Sadly this is not supported by IE, not even IE9.

问候,
马丁·科尔多瓦
www.martincordova.com
Dinamica - 与基于Eclipse的Web应用程序生成的Java EE / AJAX / SQL框架

Regards, Martin Cordova www.martincordova.com Dinamica - Java EE/Ajax/SQL framework with Eclipse based webapp generators.

这篇关于如何筛选哪些文件可以在上传对话框中可以看到?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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