public bool CheckExtension(FileUpload fp)
{
bool status = false;
string ext = System.IO.Path.GetExtension(fp.PostedFile.FileName).ToString();
switch (ext)
{
case ".doc":
case ".DOC":
case ".docx":
case ".DOCX":
case ".zip":
case ".ZIP":
case ".pdf":
case ".PDF":
case ".jpg":
case ".JPG":
case ".jpeg":
case ".JPEG":
status = true;
break;
default:
status = false;
break;
}
return status;
}
public bool CheckExtensionpdf(FileUpload fp)
{
bool status = false;
string ext = System.IO.Path.GetExtension(fp.PostedFile.FileName).ToString();
switch (ext)
{
case ".pdf":
case ".PDF":
status = true;
break;
default:
status = false;
break;
}
return status;
}
No comments:
Post a Comment