过滤文件扩展名用的FileUpload [英] Filter File extension With FileUpload

查看:268
本文介绍了过滤文件扩展名用的FileUpload的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个asp.net web应用程序,涉及使用文件上传控制。

I am writing an asp.net web app which involves the use of the FileUpload control.

现在,这个特殊的文件上传控制只希望.zip或.gz的文件类型。如果文件类型不正确上传,错误信息显示给用户。这个功能已经实现。

Right now, this particular FileUpload control only expects .zip or .gz file types. If an incorrect type of file is uploaded, An error message is displayed to the user. This functionality is already implemented.

我想要做的是过滤可见的文件类型的用户,当他点击浏览。

What I want to do is to filter the visible file types that the user sees when he clicks on "browse".

您可能已经看到一个文件打开对话框类似以下内容。结果

You may have seen a file opening dialog resembling the following.

我已经盘旋了重新presents文件扩展名过滤面积。

I've circled the area that represents the file extension filter.

这是一个功能如此普遍,我期望它被建在当前文件上传控制但经过一些网上搜索,我发现一些职位,说出来不能这样做。

This is a feature so common that I expected it to be built in to the current FileUpload Control but after some searching online, I've found some posts that say it can't be done.

这些员额从2009年,超过2年前。

Those posts were from 2009, more than 2 years ago.

现在,我的问题是:是否目前Asp.Net 4.0支持此功能?如果没有,你知道任何简单的解决方案来获得我想要的功能。

Now, My question is: does the current Asp.Net 4.0 support this feature?, and if it doesn't, do you know of any simple solution to get the functionality that I want.

我想再次指出的是,我能够验证用户是否选择支持的文件类型。所有我寻找的是一个表面上的变化,这将在打开文件对话框过滤掉不需要的文件类型。

推荐答案

我相信它是不是由浏览器不被asp.net.It控制文件类型possible.Filter是浏览器的功能。

I believe it is not possible.Filter by file type in browser is not control by asp.net.It is a browser functionality.

这个问题已经问stackoverflow.Please点击
<一href=\"http://stackoverflow.com/questions/2506821/filter-the-file-type-with-the-file-upload-control\">filter文件上传控制文件类型

This question already asked in stackoverflow.Please click filter the file type with the file upload control

这篇关于过滤文件扩展名用的FileUpload的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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