图片上传数据库,上传的时候如何限制图片的大小(长、宽) 限制文件量是可以的,图片显示的时候你可以约束他的尺寸 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 兄弟我也关心这个问题。给你点心得吧给分啊<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> ajax都是用json传值吗 删除div js焦点问题求助 js 读取UL标签中的ID获取不到 javascript页面跳转的went 如何动态改变frame的属性 showModalDialog中能否刷新数据? 页面取值函数 输入框能否对输入字符的字节数进行限制? 页面无法进入 有关iframe的问题!急 求一正则:替换掉网址
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>