Jack wrote:
> Dear all
> I had a folder which contains a lot of pdf file, the name format of the pdf
> files are : xxxxx.dateformat.pdf (eg : abcdefg.20020718.pdf).
> Now i want to use the php script to detect what files it got in a specific
> folder.
> i want to make a user input form which will let user to input the date and
> then i will look for the pdf report from this specific folder base on the
> Date given!
> 
> I think one of the quickest way is to ask php to check the filename from
> "Right to Left" which is the Date format!
> 
> But i don't know which php function will perform this task (Check filename
> from Right to Left).
> 
> If you have any other suggestion, pls help me!

I think I would do something like this:

<?php
//DATEFORMAT YYYYMMDD
if($dir=@opendir("/yourdirwithpdf")) {
   echo "Found following files:"
   while(($file=readdir($dir))!==false) {
     if(ereg("^[a-zA-Z0-9]+\.$INPUTDATE\.pdf")) {
       echo '<a href="'.$file.'">'.$file.'<\n>';
     }
   }
}
?>

Regards,
Johan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to