您的位置:首页 > 编程语言 > ASP

ASP.NET FileupLoad控件在不同浏览器中返回的文件类型

2009-03-17 10:45 405 查看
string fileType = "";
fileType = FupImage.PostedFile.ContentType;
在上传jpeg/png/gif图片的时候返回的类型分别为:
ie: "image/pjpeg" ,"image/x-png","image/gif"
firefox:"image/jpeg","image/png","image/gif"

所以验证文件类型的代码变成了:
f (fileType == "image/pjpeg" || fileType == "image/x-png" || fileType=="image/png" || fileType == "image/gif" || fileType=="image/jpeg")
{
//代码开始
}
{
//throw
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐