PHP Classes

File: example.multipleFiles.php

Recommend this page to a friend!
  Classes of Uku-Kaarel Jo~esaar   finfo   example.multipleFiles.php   Download  
File: example.multipleFiles.php
Role: Example script
Content type: text/plain
Description: Lists directory files and their mime types
Class: finfo
Determine the type of files analyzing its contents
Author: By
Last change:
Date: 12 years ago
Size: 534 bytes
 

Contents

Class file image Download
<?php

require_once('./loader.finfo.php');

$files = scandir('./dir');

//$Yo = new myfinfo(FILEINFO_MIME_ENCODING);
//$Yo = new myfinfo(FILEINFO_MIME_TYPE);
//$Yo = new myfinfo(FILEINFO_MIME);
$Yo = new finfo(FILEINFO_MIME_ENCODING|FILEINFO_MIME_TYPE);
foreach(
$files as $file) {
   
//copy($file, './dir/'.end(explode('/',$file)));
   
echo '<b><a href="./dir/' . end(explode('/',rtrim($file,'/'))) .'">'. end(explode('/',rtrim($file,'/'))) .'</a></b> '. $Yo->file('./dir/'.$file) . "<br />\n";
   
//echo "<p> {$Yo->log} </p>\n";
}