Home >Backend Development >PHP Tutorial >php filesize function_PHP tutorial

php filesize function_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:01:041356browse

php filesize function ​

filesize
(PHP 4, PHP 5)

filesize - Get file size

Description
international filesize(String$filename)
Get a file of a given size.

Parameters

File name
File path.


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

NOTE: Due to PHP's signature of integer types and the use of 32-bit integers by many platforms, filesize() may return unexpected results for files larger than 2GB in size. For file sizes of 2GB and 4GB this can usually be overcome using sprintf("%u", filesize($file)).

Example

Example of #1filesize()

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

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

?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445469.htmlTechArticlephp filesize function filesize (PHP 4, PHP 5) filesize - Get file size description international filesize (string $filename) Gets the file of the given size. Parameter file name text...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn