첨부파일 byte 용량 계산 [bytes, KB, MB, GB, TB, PB으로 변환]
12345678910111213141516171819//byte를 용량 계산해서 반환 function byteCalculation(bytes) { var bytes = parseInt(bytes); var s = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB']; var e = Math.floor(Math.log(bytes)/Math.log(1024)); if(e == "-Infinity") return "0 "+s[0]; else return (bytes/Math.pow(1024, Math.floor(e))).toFixed(2)+" "+s[e]; }Colored by Color Scriptercs첨부파일 같은 파일 사이즈를 받아서 byte, KB, MB, GB, TB, PB 형을 ..
더보기