图片上传的处理

string extname = filename.Substring(filename.LastIndexOf("."));
string datenow = DateTime.Now.ToString("yyyyMMddHHmmss")+DateTime.Now.Millisecond.ToString();
filename = datenow+extname;

#endregion

#region 存图
string path = Server.MapPath("../newsImg");
this.FilePic.PostedFile.SaveAs(path+"\\"+filename);

你可能感兴趣的:(图片上传)