限制文件量是可以的,图片显示的时候你可以约束他的尺寸

解决方案 »

  1.   

    兄弟我也关心这个问题。给你点心得吧给分啊<SCRIPT language=javascript>
    function index_image_valid(){
    var img=new Image();
    img.src=document.pho_up.pho_index.value;
    imagewidth=img.width;
    imageheigth=img.height;
    fsize=img.fileSize/1024;
    fsize=fsize.toFixed(1);
    document.pho_up.cmd.disabled=true;
    if(img.readyState!="complete")
      window.setTimeout("index_image_valid()",10);
    else
      {alert ("宽:"+imagewidth+"\n高:"+imageheigth+"\n大小:"+fsize+" KB");
       document.pho_up.cmd.disabled=false}
    }
    </script>
    </head>
    <form name="pho_up" method="post" enctype="multipart/form-data">
    <input type="file" name="pho_index" size="20">
    <input type=button name="cmd" value="测试图片大小" onclick="index_image_valid();"> 
    </form>