解决方案 »

  1.   

    http://bbs.csdn.net/topics/200055394
      

  2.   


    用这句可以获得文件类型:contentType = FileUpload1.PostedFile.ContentType;   在aspx.cs中用这句代码在上传时判断就行了
      

  3.   

    <input id="File1"  type="file"  name="File1" runat="server"  class="inputfileClass"/>
     <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"   ShowSummary="False" ValidationGroup="1" />
          <asp:RegularExpressionValidator ID="FileValidator" runat="server" ControlToValidate="File1"
               Display="None" SetFocusOnError="True"  ValidationGroup="1" ValidationExpression=".*([\.doc]|[\.xls]|[\.rar]|[\.zip]|[\.wps])$" ErrorMessage="doc,xls,rar,zip,wps">
           </asp:RegularExpressionValidator>
      

  4.   

    在前端用jQuery判断
    http://www.php100.com/html/program/jquery/2013/0905/5906.html
      

  5.   

    $('#uploadify').uploadifySettings('fileExt', '*.doc,*.docx');
    $('#uploadify').uploadifySettings('fileDesc', '*.doc,*.docx');
    设置这个属性!即使这样最好在服务端再判断一下!!不要相信客户端