I have a listbox and button on the page 1 and when i click on the button, the page 2 will open in a new tab. In the page 2, I'm uploading photos to a folder and set the session["FileName"] value. I want when i close the page 2, names of Uploaded images are displayed in listbox.
Note: session["FileName"] = names of uploaded images.
Does anyone have an idea? Please Help me.
Thank you.
my Upload class:
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(" ");
}