是否图片文件
2017-01-25 17:11:17 访问(1414) 赞(0) 踩(0)
/// <summary>
/// 是否图片文件
/// </summary>
/// <param name="attach"></param>
/// <returns></returns>
public bool IsImageFile(string str)
{
if (str == null)
return false;
str = str.Trim();
int idx = str.LastIndexOf('.');
if (idx == -1)
return false;
string strEx = str.Substring(idx + 1);
strEx = strEx.Trim().ToLower();
switch (strEx)
{
case "jpg":
return true;
case "png":
return true;
case "bmp":
return true;
case "gif":
return true;
default:
return false;
}
}
标签:
是否图片文件 


上一条:
下一条:
相关评论
发表评论