file handling
|file informations
| see demonstration of file informationsthis snippet will give you informations about a file like size, last modified date and more
full source of file informations [ line 1 - 19 ] | download file informations
| 1 | <?php |
| 2 | function ConvertSize($fs) |
| 3 | { |
| 4 | if ($fs >= 1073741824) |
| 5 | $fs = round($fs / 1073741824 * 100) / 100 . " Gb"; |
| 6 | elseif ($fs >= 1048576) |
| 7 | $fs = round($fs / 1048576 * 100) / 100 . " Mb"; |
| 8 | elseif ($fs >= 1024) |
| 9 | $fs = round($fs / 1024 * 100) / 100 . " Kb"; |
| 10 | else |
| 11 | $fs = $fs . " b"; |
| 12 | return $fs; |
| 13 | } |
| 14 | // $fil_array = stat('path/to/file/'); |
| 15 | $fil_array = stat(__file__); // demo |
| 16 | echo 'filesize: '.ConvertSize($fil_array[7]).'<br>'; |
| 17 | echo 'last access: '.date('l, F dS 20y - H:i:s',$fil_array[8]).'<br>'; |
| 18 | echo 'last modified: '.date('l, F dS 20y - H:i:s',$fil_array[9]).'<br>'; |
| 19 | ?> |
| 20 |
43 hits by 16 users in the last 30 minutes.