Exemple #1
0
	<h2>Example 7</h2>
	<p>But heck.. this class can do more, you can just pass it a path to a file and get information about the file (independently of getting the file through a directory listing using this class)</p>
	<p>For the purpose of this example, I use the first file in your filelist - but you can just point the class to any file you like.</p>

<?php 
$pathtofile = $dirobj->filelist[0];
//$pathtofile = $pathtodir . 'example/example.php';
print '<pre>filename is : <i>' . $pathtofile . '</i></pre>';
print '<pre>$dirobj->get_mime_content_type( $pathtofile )' . "\n\n";
print 'mimetype is : <i>' . $dirobj->get_mime_content_type($pathtofile) . '</i></pre>';
print '<pre>$dirobj->check_file_extension( $pathtofile, \'jpg\' )' . "\n\n";
print 'File extension check gives : <i>' . ($dirobj->check_file_extension($pathtofile, 'php') ? 'true' : 'false') . '</i></pre>';
print '<pre>$dirobj->check_file_mimetype( $pathtofile )' . "\n\n";
print 'File mimetype check against image files (default) gives : <i>' . ($dirobj->check_file_mimetype($pathtofile) ? 'true' : 'false') . '</i></pre>';
print '<pre>$dirobj->check_allowed_file( $pathtofile, \\jpg\', true )' . "\n\n";
print 'Combined check gives : <i>' . ($dirobj->check_allowed_file($pathtofile, 'php', true) ? 'true' : 'false') . '</i></pre>';
print '<pre>$dirobj->get_filesize( $pathtofile )' . "\n\n";
print 'file size is : <i>' . $dirobj->get_filesize($pathtofile) . '</i></pre>';
print '<pre>$dirobj->get_human_readable_filesize( $pathtofile )' . "\n\n";
print 'file size is : <i>' . $dirobj->get_human_readable_filesize($pathtofile) . '</i></pre>';
print '<pre>$dirobj->get_lastmod_unixts( $pathtofile )' . "\n\n";
print 'file was last modified on : <i>' . $dirobj->get_lastmod_unixts($pathtofile) . '</i></pre>';
print '<pre>$dirobj->get_human_readable_lastmod( $pathtofile )' . "\n\n";
print 'file was last modified on : <i>' . $dirobj->get_human_readable_lastmod($pathtofile) . '</i></pre>';
print '<pre>$dirobj->get_lastacc_unixts( $pathtofile )' . "\n\n";
print 'file was last accessed on : <i>' . $dirobj->get_lastacc_unixts($pathtofile) . '</i></pre>';
print '<pre>$dirobj->get_human_readable_lastacc( $pathtofile, \'l j F Y \\a\\t g:i a\' )' . "\n\n";
print 'file was last accessed on : <i>' . $dirobj->get_human_readable_lastacc($pathtofile, 'l j F Y \\a\\t g:i a') . '</i></pre>';
print '<pre>$dirobj->get_human_readable_file_permissions( $pathtofile )' . "\n\n";
print 'file permissions are : <i>' . $dirobj->get_human_readable_file_permissions($pathtofile) . '</i></pre>';
print '<pre>$dirobj->get_file_owner( $pathtofile )' . "\n\n";