上传头像代码
string str=FileUpload1.PostedFile.FileName;
int i = str.LastIndexOf(".");
string newext = str.Substring(i);
DateTime dt = DateTime.Now;
string newname = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Second.ToString();
Random rn = new Random();
newname = newname + rn.Next(11, 99).ToString();
str = "uploadfiles\\" + newname + newext;
FileUpload1.PostedFile.SaveAs(Server.MapPath(str));