我在第 1 页上有一个列表框和按钮,当我单击该按钮时,第 2 页将在新选项卡中打开。在第 2 页中,我将照片上传到文件夹并设置 session["FileName"] 值。我希望当我关闭第 2 页时,已上传图像的名称显示在列表框中。
注意: session["FileName"] = 上传图片的名称。
有人有想法吗?请帮我。
谢谢你。
我的上传课程:
public void ProcessRequest(HttpContext context)
{
if (context.Request.Files.Count > 0)
{
// get the applications path
string uploadPath = context.Server.MapPath(context.Request.ApplicationPath + "/Temp");
for (int j = 0; j <= context.Request.Files.Count - 1; j++)
{
// loop through all the uploaded files
// get the current file
HttpPostedFile uploadFile = context.Request.Files[j];
// if there was a file uploded
if (uploadFile.ContentLength > 0)
{
context.Session["FileName"] = context.Session["FileName"].ToString() + uploadFile.FileName+",";
uploadFile.SaveAs(Path.Combine(uploadPath, uploadFile.FileName));
}
}
}
// Used as a fix for a bug in mac flash player that makes the
// onComplete event not fire
HttpContext.Current.Response.Write(" ");
}