SCRIPT야

스크립트 로컬파일사이즈 알아내기

administrators 2009. 12. 18. 13:48
<form name="frm">
    <INPUT TYPE="file" NAME="atteche">
    <INPUT TYPE="button" VALUE="Size View" ONCLICK="sizeCheck()">
</form>
<script>
    function getFileSize( atteche_file ){
        var len = 0;
        var img = new Image();
        img.dynsrc = atteche_file;
        len = img.fileSize;
        return len;
    }
    function sizeCheck(){
        var len = getFileSize( document.frm.atteche.value );
        alert( Math.round( len/1024 ) + "\n" + len/1024 );
    }
</script>

- write by 꼬마갱이 09.12.24 -