PHP File filesize filetype filemtime



filesize()

The filesize() function is used to retrieve the size of the file and return the number of bytes in the file size. Otherwise, it returns FALSE.

grammar:

int filesize(string filename)

example:

$filename='test.txt';
echo $filename. 'The file size is:' .filesize($filename). 'Bytes';

Tip

The filesize() function may return unintended results when it encounters files larger than 2GB. Sprintf("% u", filesize($file)) can usually be used to overcome this problem for files between 2GB and 4GB.


filetype()

filetype() function is used to obtain the file type, the successful return of the return file type, the possible values ​​are fifo, char, dir, block, link, file and unknown. The error returns FALSE.

grammar:

String filetype(string filename)

example:

$filename='test.txt';
echo filetype($filename); // output file

filemtime()

Filemtime() function to check the file modification time, successfully returned to the file was modified last time stamp, otherwise returns FALSE.

grammar:

int filemtime(string filename)

example:

$filename="test.txt";
echo "$filename Modified date:", date("Y-m-d H: i: s", filemtime($filename));

Example output:

Test.txt Modified date: 2010-12-31 23:30:22



Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook