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!
<?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);
}
}
?>
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.
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?