note 19078 deleted from ref.filesystem by philip

From: Date: Sun, 13 Oct 2002 21:54:08 +0000
Subject: note 19078 deleted from ref.filesystem by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-38032@lists.php.net to get a copy of this message
Barrowing from fancao0515@0451.com directory example and infomation gathered through out the internet, here is a basic example that will list the file information for MP3 files, given the path of the directory you would want to display, not this will do all sub directories. will only display the information if it is valid, hope someone likes it ;> <?PHP function mp3($filename) { $FP = fopen($filename,"r"); $succes = fseek($FP,-128,SEEK_END); $validtext=fread($FP,3); if(0==strcmp("TAG",$validtext)) { $Title=fread($FP,30); $Artist=fread($FP,30); $Album=fread($FP,30); $Year=fread($FP,4); $comments=fread($FP,30); $Genre=fread($FP,1); echo "This is the Information in a MP3 file Title <br>"; echo "Title: $Title <br>"; echo "Artist: $Artist <br>"; echo "Album: $Album <br>"; echo "Year: $Year <br>"; echo "Comments: $comments <br>"; echo "Genre: $Genre <P>"; } } function list_dir($dirname) { if($dirname[strlen($dirname)-1]!='\\') $dirname.='\\'; static $result_array=array(); $handle=opendir($dirname); while ($file = readdir($handle)) { $workdirsucces=chdir($dirname); if($file=='.'||$file=='..') continue; if(is_dir($dirname.$file)) list_dir($dirname.$file.'\\'); else $result_array[]=$dirname.$file; if(ereg (".mp3$", $file)) { call_user_func('mp3',$file); } } closedir($handle); return $result_array; } call_user_func ('list_dir', "C:\\Documents and Settings\\user\\My Documents"); ?> and that ends the wackyness, hope you have fun Cartman

« previous php.notes (#38032) next »