Page 1 of 1

NEED HELP w displaying multiple files with similar filenames

Posted: Mon Sep 20, 2010 3:22 pm
by prototype18
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..

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? :?:

Re: NEED HELP w displaying multiple files with similar filen

Posted: Tue Sep 21, 2010 7:44 am
by prototype18
Can anyone help?

Re: NEED HELP w displaying multiple files with similar filen

Posted: Tue Sep 21, 2010 10:37 am
by AbraCadaver

Code: Select all

$files = glob('file1.*.pdf');