日期:2014-05-18 浏览次数:20465 次
<asp:FileUpload ID="fupImage" runat="server" CssClass="FileUp" /> <asp:RegularExpressionValidator ID="revUploadImages" ControlToValidate="fupImage" Text="请选择正确的图片文件" runat="server" ValidationExpression='[A-Za-z]\:\\[^\:\?\"\>\<\*]*\.([Gg][Ii][Ff]|[Jj][Pp][Gg]|[Bb][Mm][Pp])' ></asp:RegularExpressionValidator> <asp:Button ID="btnAddImage" runat="server" Text="提 交" OnClick="btnAddImage_Click" />
------解决方案--------------------
Path.GetExtension(strOldName)
获得文件的扩展名