protected void Button3_Click(object sender, EventArgs e) { string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName); int fileLengthInKB = FileUpload1.PostedFile.ContentLength; if (FileUpload1.HasFile) { if (fileLengthInKB < 1048576) { FileUpload1.PostedFile.SaveAs(Server.MapPath("~/upload/") + fileName); Response.Redirect(Request.Url.AbsoluteUri); } else { MessageBox.Show("Enter a file less than 1 MB"); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)