文件上传
string userid = "qian"; string FilePath = System.Web.HttpContext.Current.Request.MapPath("memberpic/" + userid+"/"); if (!Directory.Exists(FilePath)) { Directory.CreateDirectory(FilePath); } string photoName1 = FileUpload1.PostedFile.FileName; //获取初始文件名 int i = photoName1.LastIndexOf("."); //取得文件名中最后一个"."的索引 string newext = photoName1.Substring(i); //获取文件扩展名 //重新为文件命名,获取时间的年月日时分秒部分 FileUpload1.PostedFile.SaveAs(Server.MapPath("memberpic/" + userid+"/" + userid + newext));

浙公网安备 33010602011771号