echo ' - z folderami- use recursive<br />'; print 'filecount is (z podfolderem): ' . $dirobj->filecount; echo '<br />'; $myList = $dirobj->get_human_readable_dirsize(null, $pathtodir, true); print_r($myList); echo '<br />'; $myList = $dirobj->get_human_readable_filesize($pathtodir . 'Malta 1266.jpg'); print_r($myList); echo '<br />'; $zmieniony = $dirobj->get_human_readable_lastmod($pathtodir . 'Malta 1266.jpg'); echo "zmieniony {$zmieniony}"; echo '<br />'; $ext_check = $dirobj->check_file_extension($pathtodir . 'Malta 1266.jpg', 'jpg'); echo "czy rozszerzenie jpg : {$ext_check}"; echo '<br />'; $typ_mime = $dirobj->get_mime_content_type($pathtodir . 'class_dirtool-2005-12-29.zip'); //$typ_mime = mime_content_type($pathtodir . 'class_dirtool-2005-12-29.zip'); echo '<br />'; echo 'get_most_recent_file<br /> '; $myList = $dirobj->get_most_recent_file(null, $pathtodir, true); print_r($myList); echo '<br />'; echo date($dirobj->datetime_format, $myList['last_modified']); echo '<br />'; echo '<br />'; echo '<br />'; echo '<br />'; $myList = $dirobj->get_sorted_dirlist(null, $pathtodir, true); echo 'lista folderow sort : '; print_r($myList); echo '<br />';
print '<pre>'; print_r(array_merge($dirobj->get_sorted_dirlist(false), $dirobj->get_sorted_filelist(false, true))); print '</pre>'; ?> <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";