我是用FileField.PostFile.ContentType != "*.html" && FileField.PostedFile.ContentType != "*.htm"";
但没有用,请问错在哪?

解决方案 »

  1.   

    我问的就是htm、mpg文件的类型在代码中怎样表示,
    是不是*.mpg、*.htm??还是其他?
    比如图象文件语法为 image/gif,
    mpg、htm 应怎样表述?
      

  2.   

    同意 xhbmj(动感超人) function upload()
    {
      if(document.all('file1').filename.right(3) != 'mpg' || ...)//这儿的代码你要去查下帮助了:P
        return false;
      else
        return true;
    }在提交按钮上:
    <input type=button runat=server onclick='return upload();' value='上传'>
      

  3.   

    if(MyFile.PostedFile.ContentType != "image/gif" 
    && MyFile.PostedFile.ContentType != "image/jpg" 
    && MyFile.PostedFile.ContentType != "image/pjpeg" 
    && MyFile.PostedFile.ContentType != "image/jpeg")
    {

    //只能是图片格式
    Response.Write("<script>alert('您要上传的照片格式只能是JPG或GIF格式.');</script>");
    return false;
    }
      

  4.   

    myfile.Accept(格式)
    这样可以限定吧
      

  5.   

    FileField.PostedFile.ContentType != "text/html";
    FileField.PostedFile.ContentType != "video/mpeg";
    FileField.PostedFile.ContentType != "video/mpg";
      

  6.   

    多谢各位朋友热情回复,
    多谢xrll()。