NEED HELP w displaying multiple files with similar filenames
Posted: Mon Sep 20, 2010 3:22 pm
need to display multiple files that have a similar file name, but there are timestamps added to the filename once its been modified. What could I use in PHP to display all these files?
Right now I use a $path variable that looks into a SQL table to build the path to the folder that the files reside in..
So there is a file called file1.pdf then another one called file1.mmddyyyy.pdf
My code shows file1.pdf but not file1.mmddyyyy.pdf
Is there some kind of wildcard I can use to get it to show all the files if they exist? Or how can I implement the glob function into this?
Right now I use a $path variable that looks into a SQL table to build the path to the folder that the files reside in..
Code: Select all
ELSEIF($Recordmyrow['Applicatio'] == "pdf file")
{
IF($securityvalue != "P"){$display = false;}
IF(file_exists(substr($path, 5))){}
ELSE{$column4 = "<A href='javascript:mbox();'>UNAVAILABLE</A>";}
}
//Check display value and print row
IF($display)
{
//Check if file exists
IF(substr($path, 0, 5) == "file:")
{
IF(file_exists(substr($path, 5)))
{
IF(strtolower(substr($path, -4, 4)) == ".pdf")
{
$column4 = "<A HREF=pdf.php?src=".substr($path,5).">VIEW</A>";
}
IF(strtolower(substr($path, -4, 4)) == ".jpg")
{
$column4 = "<A HREF=jpg.php?src=".substr($path,5).">VIEW</A>";
}
}
ELSE{$column4 = "Not Available";}
}So there is a file called file1.pdf then another one called file1.mmddyyyy.pdf
My code shows file1.pdf but not file1.mmddyyyy.pdf
Is there some kind of wildcard I can use to get it to show all the files if they exist? Or how can I implement the glob function into this?