logo

New Response

« Return to the main article

You are replying to:

  1. Dear check it out it may help u.

    Or u can use Reqular expression validator for the purpose

    if (FileUpload1.HasFile) { string[] FileExt ={ ".exe", ".txt", ".dat", "EXE", "TXT" }; for (int i = 0; i < FileExt.Length; i++) { if (UpPath.Contains(FileExt[i])) { chk = false; }

    } if (chk == false) { Filemsg.Text = "Invalid File Format"; } else { FileUpload1.SaveAs(UpPath); Filemsg.Text = "File Uploaded Succesfully"; FileName.InnerHtml = FileUpload1.PostedFile.FileName; FileType.InnerHtml = FileUpload1.PostedFile.ContentType; Size.InnerHtml = Convert.ToString(FileUpload1.PostedFile.ContentLength); FileDetail.Visible = true; } } else { Filemsg.Text = "Uploading Failed! Select some file to Upload"; FileDetail.Visible = false; } }

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: