i want to upload only zip files by c#, the format of file should be "ab_data.zip" format (start from 2 char thn one underscore thn after 4 chars)
my code is.......
string fileNameText = null;
string fileextension;
filename = Fileuploading.Value.ToString().Trim();
if (Fileuploading.PostedFile!=null)
{
if(Fileuploading.PostedFile.InputStream.Length > 0)
{
fileextension = Path.GetExtension(filename.ToString().ToLower()); if(fileextension != ".zip")
{
//error message;
}
else
{
fileNameText=filename.Substring(filename.LastIndex Of(directoryseperater)+1,filename.Length-(filename.LastIndexOf(directoryseperater)+ 1));
Fileuploading.PostedFile.SaveAs(Request.MapPath("/AspNetLearn/Upload")+ "//"+ fileNameText);
filepath = ("/AspNetLearn/Upload") + "/" + fileNameText ;
//message success;
}
}
}
plzzzz anyone help me...