我使用FileUpload服務器控件創建了上傳頁面。我使用正則表達式驗證器來驗證文件擴展名。驗證在Firefox中上傳文件的文件擴展名
<asp:FileUpload ID="AttachmentUpload" CssClass="text" size="58" Width="376px" IE:Width="385px" runat="server"/>
<asp:RequiredFieldValidator SetFocusOnError="true"
ID="AttachmentUploadRequire"
runat="server"
ControlToValidate="AttachmentUpload"
Display="None"
ErrorMessage="Please select a file to attach."/>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
ErrorMessage="The selected file type is not allowed!"
ControlToValidate="AttachmentUpload"
Display="None"
ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(\.[mM][pP]3|\.[mM][pP][eE][gG]|\.[sS][wW][fF]|\.[dD][oO][cC]|\.[tT][xX][tT]|\.[jJ][pP][gG]|\.[jJ][pP][eE][gG]|\.[pP][nN][gG]|\.[xX][lL][sS]|\.[pP][dD][fF]|\.[gG][iI][fF]|\.[pP][pP][tT])$"/>
它是確定的Chrome和IE,但不正常的Firefox瀏覽器。我該如何解決它?
Firefox怎麼不行?你看到一個錯誤?這是不是在做你期望的? – Tim
正則表達式驗證程序正在精細地處理其他瀏覽器。但驗證器不在Firefox上工作。我的意思是錯誤警告框不顯示。 – zanhtet