Reading File Name

From: Date: Fri, 14 Feb 2003 00:40:17 +0000
Subject: Reading File Name
Groups: php.general 
Request: Send a blank email to php-general+get-135541@lists.php.net to get a copy of this message
Hello all, I am fairly new to PHP and I am trying to read files in the directory (gif files)and based on the names of the files create links on the page. The words within the file will be separated with underscores(02_13_2002_This_file_name.gif but I do not have to use underscores if it is going to make things easier). I am also trying to sort the names as they are represented as names/dates combination.. Could anyone help me to jump start this especially with splitting the name and sorting? Should I read the file names into an array and sort it? (read first 10 characters [date] split it - put into an array; then read the rest parse it and place into an array?) Here is what I have so far (basically reading files in a directory - not tested yet): <? $file_dir="other"; $dir=opendir($file_dir); while ($file=readdir($dir)) { if ($file !="." && $file !="..") { echo "< a href=".$file_dir."/".$file.">".$file."</a>"; } } ?> -- Best regards, Paul mailto:pax@cfl.rr.com

« previous php.general (#135541) next »