ページ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(" ");
}