Change language

PHP Filesize () function

|
The result of the filesize() function is cached, and the clearstatcache() function is used to clear the cache.Syntax:
filesize ($filename)
Parameters:The filesize() function in PHP takes only one parameter, $filename. It specifies the name of the file whose size you want to check.Returned value:Returns the file size in bytes on success and False on error.Errors and Exceptions :
  • For files larger than 2 GB, some filesystem functions may return unexpected results because the PHP integer type is signed and many platforms use 32-bit integers.
  • The buffer should be flushed if the filesize() function is used multiple times.
  • The filesize() function will issue E_WARNING on failure.
  • Examples:
    Input: echo filesize ("gfg.txt"); Output: 256 Input: $myfile = ’gfg.txt’; echo $myfile. ’:’. filesize ($myfile). ’bytes’; Output: gfg.txt: 256 bytes
    The programs below illustrate the filesize() function.Program 1 :  
    // display file size using
    // filesize() function echo filesize ( "gfg.txt" );  
    ?>
    Output:
    256
    Program 2 :  
    // display file size using
    // filesize function() $myfile = ’gfg .txt’ ; echo $myfile . ’:’ . filesize ( $myfile ). ’bytes’ ;  
    ?>
    Output:
    gfg.txt : 256 bytes
    Link:
    http: // php .net / manual / en / function.filesize.php

    Shop

    Learn programming in R: courses

    $

    Best Python online courses for 2022

    $

    Best laptop for Fortnite

    $

    Best laptop for Excel

    $

    Best laptop for Solidworks

    $

    Best laptop for Roblox

    $

    Best computer for crypto mining

    $

    Best laptop for Sims 4

    $

    Latest questions

    NUMPYNUMPY

    Common xlabel/ylabel for matplotlib subplots

    12 answers

    NUMPYNUMPY

    How to specify multiple return types using type-hints

    12 answers

    NUMPYNUMPY

    Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

    12 answers

    NUMPYNUMPY

    Flake8: Ignore specific warning for entire file

    12 answers

    NUMPYNUMPY

    glob exclude pattern

    12 answers

    NUMPYNUMPY

    How to avoid HTTP error 429 (Too Many Requests) python

    12 answers

    NUMPYNUMPY

    Python CSV error: line contains NULL byte

    12 answers

    NUMPYNUMPY

    csv.Error: iterator should return strings, not bytes

    12 answers


    Wiki

    Python | How to copy data from one Excel sheet to another

    Common xlabel/ylabel for matplotlib subplots

    Check if one list is a subset of another in Python

    sin

    How to specify multiple return types using type-hints

    exp

    Printing words vertically in Python

    exp

    Python Extract words from a given string

    Cyclic redundancy check in Python

    Finding mean, median, mode in Python without libraries

    cos

    Python add suffix / add prefix to strings in a list

    Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

    Python - Move item to the end of the list

    Python - Print list vertically