NEED HELP w displaying multiple files with similar filenames

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
prototype18
Forum Commoner
Posts: 25
Joined: Wed Aug 18, 2010 9:52 am

NEED HELP w displaying multiple files with similar filenames

Post 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? :?:
prototype18
Forum Commoner
Posts: 25
Joined: Wed Aug 18, 2010 9:52 am

Re: NEED HELP w displaying multiple files with similar filen

Post by prototype18 »

Can anyone help?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: NEED HELP w displaying multiple files with similar filen

Post by AbraCadaver »

Code: Select all

$files = glob('file1.*.pdf');
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply