上传文件时,判断该文件的大小(只适用于图片文件)

来源:互联网 发布:网页美工金典案例教程 编辑:程序博客网 时间:2024/05/01 16:07

<script type="text/javascript">   

function getFileSize(filePath)   

{   

  var image=new Image();   

  image.src=filePath;   

  alert(image.fileSize);   

}   

</script>   

 

<input type="file" name="file" onchange="getFileSize(this.value)">   

 

 

原创粉丝点击