$fileTypes='*.png';

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
bajere
Forum Newbie
Posts: 20
Joined: Fri Jul 03, 2009 6:20 am

$fileTypes='*.png';

Post by bajere »

hi all,

im sure this is very simple, but im not to quick on php code...
how do i add more file types to the .png.

thanks in advance.

grant

Code: Select all

 
 
<?php
$expiretime=1; //expire time in minutes
 
$tmpFolder="stuff/";
 
$fileTypes='*.png';
 
foreach (glob($tmpFolder . $fileTypes) as $Filename) {
 
// Read file creation time
$FileCreationTime = filectime($Filename);
 
// Calculate file age in seconds
$FileAge = time() - $FileCreationTime;
 
// Is the file older than the given time span?
if ($FileAge > ($expiretime * 60)){
 
// Now do something with the olders files...
 
//print "The file $Filename is older than $expire_time minutes\n";
 
//deleting files:
unlink($Filename);
}
 
}
?>
 
 
 
 
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: $fileTypes='*.png';

Post by AbraCadaver »

Read the glob() page: http://us3.php.net/manual/en/function.glob.php Especially the GLOB_BRACE flag.
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.
bajere
Forum Newbie
Posts: 20
Joined: Fri Jul 03, 2009 6:20 am

Re: $fileTypes='*.png';

Post by bajere »

AbraCadaver wrote:Read the glob() page: http://us3.php.net/manual/en/function.glob.php Especially the GLOB_BRACE flag.

Thanks for the link mate, but i have no idea what it all means. i found the code i have at the moment just to help someone out. we need to click a button on a web page to delete certain files on the server in a certain folder.... do you know of any ways to do this?

cheers
Post Reply