TheyCallMeLuke Posted January 26, 2007 Share Posted January 26, 2007 I've created a website that uploads files to a folder in the website. I actually got my PHP script to work...kind of. The script will display the contents of the folder just fine, but I also need the script to tell me the date and time it was modifed/uploaded. Does anyone know what I can do to make this work? I'm kinda a newbie at PHP, so this is probably much easier than I'm making it out to be.Here is my code:<?PHP /** * Change the path to your folder. * * This must be the full path from the root of your * web space. If you're not sure what it is, ask your host. * * Name this file index.php and place in the directory. */ // Define the full path to your folder from root $path = "UPLOADS/annualmeeting"; // Open the folder $dir_handle = @opendir($path) or die("Impossible d'ouvrir le dossier $path"); // Loop through the files while ($file = readdir($dir_handle)) { if($file == "." || $file == ".." || is_dir($file) || $file == "mm_menu.js" || $file == "index.php" || substr($file,-3) == "txt" ) continue; $fichierexp = $path."/".$file.".txt"; $TheLinkedFile = $path."/".$file; if(file_exists($fichierexp)) { @$fp = fopen($fichierexp,'r'); echo "<a href=\"$TheLinkedFile\">".fgets($fp,999)."[/url]"; fclose($fp); } else { echo "<a href=\"$TheLinkedFile\">".$file."[/url]"; } } // Close closedir($dir_handle); ?>It would be greatly appreciated if someone helped me out. I'm suppose to have this finished by mid of next week. :'( Link to comment https://forums.phpfreaks.com/topic/35823-display-content-of-a-folder/ Share on other sites More sharing options...
kenrbnsn Posted January 26, 2007 Share Posted January 26, 2007 You want to look at the functions [url=http://www.php/net/filectime]filectime()[/url] and [url=http://www.php.net/filemtime]filemtime()[/url]Ken Link to comment https://forums.phpfreaks.com/topic/35823-display-content-of-a-folder/#findComment-169839 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.