protected void btnUpload_Click(object sender, EventArgs e) { int sessionCount = Session.Count; for (int i = sessionCount - 1; i >= 0; i--) { if (sessionCount <= 3) { HtmlInputFile hif = (HtmlInputFile)Session["myupload" + i]; if (hif.PostedFile.ContentLength <= 500000) { string storePath = Server.MapPath("~") + "/MultipleUpload"; if (!Directory.Exists(storePath)) Directory.CreateDirectory(storePath); hif.PostedFile.SaveAs(storePath + "/" + Path.GetFileName (hif.PostedFile.FileName)); lblError.Text = "Your Files are uploaded successfully"; ListBox1.Items.Clear(); } else lblError.Text = "An error occured"; } else lblError.Text = "You have exceeded the maximum number of files to be uploaded (3)"; } Session.RemoveAll(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)