更新时间:2023-02-25 13:26:08
使用 Extensions 属性来设置它们.虽然根据文档
Use the Extensions property to set them. Although according to the documentation
文件扩展名,或默认文件扩展名(.png",.jpg"、.jpeg"和.gif")如果未设置该属性.
The file name extensions, or the default file extensions (".png", ".jpg", ".jpeg", and ".gif") if the property is not set.
您可以像设置 ErrorMessage
一样设置它.更可能的问题是它不知道如何评估 HttpPostedFileBase
是否具有正确的扩展名.您需要使用 MVC 框架中的框架或创建自己的框架.
You can set it just like you did the ErrorMessage
. The more likely issue is that it doesn't know how to assess whether the HttpPostedFileBase
has the right extension. You'll need to use the one from the MVC framework or create your own.