用javascript就可以搞定了:
function showsize()
{
document.upload.FILE1.value = trim(document.upload.FILE1.value);
document.all.view.src = document.upload.FILE1.value;
//alert(document.all.view.height + "x" + document.all.view.width + " -> " + document.all.view.fileSize);
var diskuse = 6255309
var quota = 20971520
var maxfilesize = 2097152;
var showimg = new Image();
showimg.src = document.upload.FILE1.value;
if(showimg.fileSize>0)
{
if(showimg.fileSize > maxfilesize)
{
alertmsg = "您选中的图片大于" + maxfilesize+ ",目前字节数=" + showimg.fileSize;
return false;
} if(showimg.width > 500)
{
var ori_w= showimg.width;
var ori_h = showimg.height;
showimg.width = 500;
showimg.height = ori_h * showimg.width / ori_w;
} if(showimg.width < 5 || showimg.height <5)
{
showimg.width = showimg.height = 150;
} //document.all.view.src = showimg.src;
document.all.view.style.width = showimg.width;
document.all.view.style.height = showimg.height;
checkShowSize = true;
return true;
} else if(loadNum<loadTimes) {
loadNum ++ ;
setTimeout('showsize()',500);
} else if(loadNum>=loadTimes){
loadNum = 0;
//alertmsg = "图片字节数=0,请换张图片上传";
alertmsg = "图片预览失败,请重新上传";
return false;
}
}
function showsize()
{
document.upload.FILE1.value = trim(document.upload.FILE1.value);
document.all.view.src = document.upload.FILE1.value;
//alert(document.all.view.height + "x" + document.all.view.width + " -> " + document.all.view.fileSize);
var diskuse = 6255309
var quota = 20971520
var maxfilesize = 2097152;
var showimg = new Image();
showimg.src = document.upload.FILE1.value;
if(showimg.fileSize>0)
{
if(showimg.fileSize > maxfilesize)
{
alertmsg = "您选中的图片大于" + maxfilesize+ ",目前字节数=" + showimg.fileSize;
return false;
} if(showimg.width > 500)
{
var ori_w= showimg.width;
var ori_h = showimg.height;
showimg.width = 500;
showimg.height = ori_h * showimg.width / ori_w;
} if(showimg.width < 5 || showimg.height <5)
{
showimg.width = showimg.height = 150;
} //document.all.view.src = showimg.src;
document.all.view.style.width = showimg.width;
document.all.view.style.height = showimg.height;
checkShowSize = true;
return true;
} else if(loadNum<loadTimes) {
loadNum ++ ;
setTimeout('showsize()',500);
} else if(loadNum>=loadTimes){
loadNum = 0;
//alertmsg = "图片字节数=0,请换张图片上传";
alertmsg = "图片预览失败,请重新上传";
return false;
}
}
var maxfilesize = 20971;var showimg = new Image();
showimg.src = document.upload.FILE1.value;
if(showimg.fileSize>0)
{
if(showimg.fileSize > maxfilesize)
{
alertmsg = "您选中的图片大于" + maxfilesize+ ",目前字节数=" + showimg.fileSize;
alert("您的图片介绍超过32字,目前字数="+showimg.fileSize);
return false;
}
那东东可好用了