3

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.

1
  • 1
    used it but not working with it also Commented Aug 12, 2013 at 11:01

1 Answer 1

3

File Uploader was not accepting file with size 0 kb .

Once i entered some random text within it, it started taking values,

fileuploderdoc.hasfile became true.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.