62,050
社区成员
发帖
与我相关
我的任务
分享
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Params["userid"] != null)
{
string savepath = Server.MapPath("~/images/");
if (!System.IO.Directory.Exists(savepath))
{
System.IO.Directory.CreateDirectory(savepath);
}
if (FileUpload1.HasFile)
{
if (Session["userid"] != null)
{
string extention = System.IO.Path.GetExtension(savepath + FileUpload1.FileName);//文件后缀类型
string filename = Session["userid"].ToString() + extention;
FileUpload1.SaveAs(savepath + filename);
}
}
}
}