ASP.NET - 在FileUpload控件浏览器中仅显示图像文件

问题描述:

大家好,



我想在按钮点击时显示fileupload控制浏览器,然后在文件上传浏览器中显示

它显示所有文件(文件类型是底部的所有文件),现在我只需要显示图像格式(jpg,gif,png)

当文件上传浏览器打开时,请发送编码给我。提前谢谢。

Hi guys,

I want to display the fileupload control browser when the button click, and after that in the file upload browser
it display all the files( file type is All files in the bottom), now i need only display the image format(jpg,gif,png)
when the file upload browser open, please send the coding to me. thanks in advance.

不需要这个。你不能限制。但有一种方法。请参阅 - 使用< input type =file>?时限制文件格式[ ^ ]。



理想情况下你应该验证文件类型 - ASP.Net FileUpload:文件扩展验证 [ ^ ]。
No need of this. You cannot restrict. But there is a way. Refer - Limit file format when using <input type="file">?[^].

You should ideally validate the file type - ASP.Net FileUpload : File Extension Validation[^].