check upload file is zip or not

Posted by Pokuri31 under ASP.NET on 4/1/2009 | Views : 1403 | Status : [Member] | Replies : 1
Dear all,



Before attach or upload any file , check whether it is zip file or not .


Thanking You,
Rana.




Responses

Posted by: Neeks on: 4/1/2009 [Member] Bronze

Up
0
Down
protected void btn_Click(object sender, EventArgs e)

{
//testFile is an object of File Upload Contol
if((testFile.FileName.Substring(testFile.FileName.LastIndexOf(".") + 1)).ToLower() = "zip")
Response.Write("This is a zip file");
else
Response.Write("This is not a zip file");
}


Pokuri31, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response