艺海无涯,学无止境。欢迎一起探讨技术和人生,了解我

Fineui FileUpload限制上传为图片类型

<f:FileUpload runat="server" ID="filePhoto" ButtonText="上传个人头像" AcceptFileTypes="image/*" ButtonOnly="true" AutoPostBack="true" OnFileSelected="filePhoto_FileSelected"></f:FileUpload>

 


//文件类型验证
string fileName = filePhoto.ShortFileName;
if (!ValidateFileType(fileName))
{
Alert.Show("无效的文件类型!");
return;
}