50分了,进来吧
一个程序,向服务器传图片,图片名字为1,2,3,4……,要求每次上传后图片名字自动加1,
string[] dirs = Directory.GetFiles(HttpContext.Current.Server.MapPath("/") + "/picture/Statue of Liberty/");
int max=0;
//求出名字最大的图片的名字
for(int j=0;j<dirs.Length;j++)
{
if (Convert.ToInt32(dirs[j]) > max)
{
max = Convert.ToInt32(dirs[j]);
}
}
//新图片的路径
paths = HttpContext.Current.Server.MapPath("/") + "/picture/Statue of Liberty" + "/" + (max+1).ToString();
各位大侠,我哪里错了?