This is my updated code below. I am getting a new_file_name with microtime, but I am not getting an extension. I get the name plus a period (.), no extension. For some reason, the database is not being updated either. I wonder if I need to change the file name to something with the extension and then insert it into the part below in Red. In other words, get the extension of the upload file, change the name with microtime() and then put the two together and then insert it into the copy statement.
//Creates ID folder in the upload directory
$foldername = "". $_REQUEST['ID'] ."";
if(!is_dir("photos/$foldername"))
{mkdir ("photos/$foldername", 0777);
chmod ("photos/$foldername", 0777);}
else {}
$resourcefolder = "photos/";
$filestocopy = array();
$filestocopy[0] = "slideshow.php";
//$filestocopy[1] = "template.html";
$frompath = "photos/";
$topath = "photos/".$foldername."/";
foreach ($filestocopy as $value)
{
copy ($frompath.$value,$topath.$value);
}
//Get file extension
$extension = strrchr($userfile, ".");
//Make New File Name
$new_file_name = md5(microtime());
//Copies file to specified location
if (copy($userfile, "photos/$foldername/[COLOR=Red]$new_file_name.$extension[/COLOR]")) {
$userfile_location = "photos/$foldername";
//Deletes file in TMP directory
unlink($userfile);
//Add File info to database
add_file($yourname, $email_address, $caption, $userfile_location, $new_file_name, $_REQUEST['ID']);
} else {
require("header.php");
echo "Your file could not be copied.\n";
require("footer.php");
}