File extension validation from C# code behind for Asp.net file upload control
File extension upload validation from C# code behind for Asp.net file upload control
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vithal WadjePosted Oct 23, 2012, 6:42 AM
if (FileUpload1.HasFile)
{
try
{
switch (ext)
{
case ".xls":
type = "application/vnd.ms-excel";
break;
case ".xlsx":
type = "application/vnd.ms-excel";
break;
}
arjunan selvamPosted Sep 24, 2012, 5:57 AM
FileUpload
Simple validation using javascript.