How to use PHP & Get File Properties Learn how to use the PHP to Get File Properties
ShotDev Focus:
- PHP & Get File Properties
Example
php_file_properties.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <?php $strFileName = "shotdev/my.txt"; $objFopen = fopen($strFileName,"r"); echo "Files Size = ".filesize($strFileName) . "<br>"; echo "Read able = ".is_readable($strFileName) . "<br>"; echo "Write able = ".is_writable($strFileName) . "<br>"; echo "Modify Date = ".date( "D d M Y g:i A", filemtime($strFileName)) . "<br>"; echo "Last Updated Time = ".date( "D d M Y g:i A", filemtime($strFileName)) . "<br>"; fclose ($objFopen); ?> </body> </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_file_properties.php
Screenshot
2presenting…
…