How to get the File Size and File Type of File / Folder in PhP With Example Source Code
Guys, By using the following code we can find out the File size and type of files/ folders in a directory . The help is give as comments and if have any more doubt then please comment Example Code <?php $myDirectory = opendir("rootFolder"); // get each entry while($entryName = readdir($myDirectory)){ $dirArray[] = "rootFolder/".$entryName; } // close directory closedir($myDirectory); // count elements in array $indexCount = count($dirArray); Print ("$indexCount files<br>\n"); // sort 'em sort($dirArray); // print 'em print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n"); print("<TR><TH>Filename</TH><th>Filetype</th><th>Filesize</th></TR>...