Answer in C# would also help me.
I have two file uploaders in my page in which i have to do validations.
First fileuploader is for .doc or docx file and second one is for ppt or pptx file.
Following is the code:
If fuAttachmentDoc.HasFile = True Then
If Not UCase(System.IO.Path.GetExtension(fuAttachmentDoc.FileName)) = ".DOC" Then
If Not UCase(System.IO.Path.GetExtension(fuAttachmentDoc.FileName)) = ".DOCX" Then
gc.ShowErrorMsg("Please Select DOC File")
End If
End If
Else
gc.ShowErrorMsg("Please Select DOC File")
End If
If fuAttachmentppt.HasFile Then
If Not System.IO.Path.GetExtension(fuAttachmentppt.FileName) = ".PPT" Then
If Not System.IO.Path.GetExtension(fuAttachmentppt.FileName) = ".PPTX" Then
gc.ShowErrorMsg("Please Select PPT File")
End If
End If
Else
gc.ShowErrorMsg("Please Select PPT File")
End If
If i select file in only one file uploader i.e. if only for doc file or only ppt file uploader then it makes fuAttachmentDoc.HasFile=true or fuAttachmentppt.HasFile=true otherwise if i select two files then it keeps both as false and does not enters into condition.
I am not able to understand why is this happening.
Please help me.
Answer in C# would also help me.