파일시스템 함수 목록
PHP Manual

filesize

(PHP 4, PHP 5)

filesizeGets file size

설명

int filesize ( string $filename )

Gets the size for the given file.

인수

filename

Path to the file.

반환값

Returns the size of the file in bytes, or FALSE (and generates an error of level E_WARNING) in case of an error.

Note: Because PHP's integer type is signed and many platforms use 32bit integers, filesize() may return unexpected results for files which are larger than 2GB. For files between 2GB and 4GB in size this can usually be overcome by using sprintf("%u", filesize($file)).

예제

Example #1 filesize() example

<?php

// outputs e.g.  somefile.txt: 1024 bytes

$filename 'somefile.txt';
echo 
$filename ': ' filesize($filename) . ' bytes';

?>

주의

Note: 이 함수의 결과는 캐시에 저장합니다. 자세한 설명은 clearstatcache()를 참고하십시오.

Tip

PHP 5.0.0부터 이 함수는 몇몇 URL 래퍼를 사용할 수 있습니다. 기능적으로 stat() 패밀리를 지원하는 래퍼 목록은 지원 프로토콜/래퍼 목록를 참고하십시오.

참고


파일시스템 함수 목록
PHP Manual