3
在C#中的答案也會幫助我。asp.net中的文件上傳器沒有顯示文件
我有兩個文件上傳在我的頁面中,我必須做驗證。
第一個文件上傳器用於.doc或docx文件,第二個用於ppt或pptx文件。
以下是代碼:
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
如果我只有一個文件上傳選擇的文件即如果只爲doc文件或僅PPT文件上傳,然後它使fuAttachmentDoc.HasFile=true
或fuAttachmentppt.HasFile=true
否則,如果我選擇了兩個文件,然後將其保持兩者都爲假,並且不會進入狀況。
我無法理解爲什麼會發生這種情況。
請幫幫我。
在C#中的答案也將幫助我。
PLZ使用更新面板 – Harsh
使用它,但不使用它也 –