【发布时间】:2013-08-13 15:42:10
【问题描述】:
用 C# 回答也会对我有所帮助。
我的页面中有两个文件上传器,我必须在其中进行验证。
第一个文件上传器用于 .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 否则,如果我选择两个文件,则它将两者都保留为 false 并且不会进入条件。
我无法理解为什么会这样。
请帮帮我。
用 C# 回答也会对我有所帮助。
【问题讨论】:
-
使用过但也无法使用
标签: c# asp.net .net vb.net visual-studio-2008