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

Tutorial Básico PHP

Tutorial Avançado PHP

PHP & MySQL

Manual de Referência PHP

Uso e Exemplo da Função PHP filesize()

PHP Filesystem Referência Manual

A função filesize() pode retornar o tamanho do arquivo especificado. Se sucesso, a função pode retornar o tamanho do arquivo (em bytes), se falhar, retorna false.

Sintaxe

int filesize (string $filename)

Se houver um erro, esta função pode retornar o tamanho do arquivo (em bytes) ou false (e pode gerar um erro de nível E_WARNING).

Exemplo Online

<?php
   $filename = "sample.txt";
   echo $filename . ': ' . filesize($filename) . ' bytes';
?>
Testar para ver‹/›

Resultado de Saída

sample.txt: 27 bytes

PHP Filesystem Referência Manual