I have an image upload script... It works fine except when I want it to be placed in two different folders. Here is the code.
// $userfile being the variable from the form...
$uploadPath = "pathToMyFolder/";
$upfile1 = $uploadPath."/folder1/".$userfile_name;
$upfile2 = $uploadPath."/folder2/".$userfile_name;
$newName = "myImage.jpg";
if($userfile_name != "")
{
move_uploaded_file($userfile, $upfile1);
rename ($upfile1, $uploadPath.$newName);
}
if($userfile_name != "")
{
move_uploaded_file($userfile, $upfile2);
rename ($upfile2, $uploadPath.$newName);
}
it uploads to the first folder and than
shoots out an error to the second folder saying there is no such directory, I know there is so thats not the problem. Any help on why this is, I would appreciate it.
Thanks for your time.