string filename = "";
if (nametype == 1)
{
string nowdate = DateTime.Now.ToString();
nowdate = nowdate.Replace(":", "").Replace(" ", "").Replace("-", "").Trim();
Random r = new Random();
int a = r.Next(1000);
filename = nowdate + a.ToString() + Type;
newFileName = filename;
}
else
{
filename = fu.FileName;
if (System.IO.File.Exists(path + filename)) { erorr = "此文件名已经存在!"; return erorr; }
}
fu.SaveAs(path + filename);
return erorr;//返回有错的错误信息,没有错误返回null
}
#endregion