English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

Usage and example of PHP filesize() function

PHP Filesystem 参考手册

The filesize() function can return the size of the specified file. If successful, this function can return the file size (in bytes), if failed, it returns false.

Syntax

int filesize ( string $filename )

If an error occurs, this function can return the file size (in bytes) or false (and can generate an E_WARNING level error).

Online example

<?php
   $filename = "sample.txt";
   echo $filename . ': ' . filesize($filename) . ' bytes';
?>
Test see if‹/›

Output result

sample.txt: 27 byte

PHP Filesystem 参考手册