1个回答
展开全部
public void getImageUrl()
{
string imgtype = "*.BMP|*.JPG|*.GIF|*.PNG";
string[] ImageType = imgtype.Split('|');
for (int i = 0; i < ImageType.Length; i++)
{
string[] dirs = Directory.GetFiles(@"d:\\My Documents\\My Pictures", ImageType[i]);
foreach (string dir in dirs)
{
string temp = dir;
temp = temp.Substring(temp.LastIndexOf('\\')+1);//得到文件名
Response.Write("<p>" + temp + "</p>");
}
}
}
{
string imgtype = "*.BMP|*.JPG|*.GIF|*.PNG";
string[] ImageType = imgtype.Split('|');
for (int i = 0; i < ImageType.Length; i++)
{
string[] dirs = Directory.GetFiles(@"d:\\My Documents\\My Pictures", ImageType[i]);
foreach (string dir in dirs)
{
string temp = dir;
temp = temp.Substring(temp.LastIndexOf('\\')+1);//得到文件名
Response.Write("<p>" + temp + "</p>");
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询