Hey Guys... new guy to PHP. but not to coding.... I am trying to make a form that sends an email to me with the data, populates it to a database, and uploads a photo to a directory.
I have everything working except the photo.
Here is the code:
// Validation
if( $Photo_Size == 0)
{
header("Location: http://ldepadrinos.org/bad.html");
exit;
}
if( $Photo_Size >500000)
{
//delete file
unlink($Photo_Temp);
header("Location: http://ldepadrinos.org/bad.html");
exit;
}
if( $Photo_Mime_Type != "image/gif" AND $Photo_Mime_Type != "image/jpeg" AND $Photo_Mime_Type != "image/png" )
{
unlink($Photo_Temp);
header("Location: http://ldepadrinos.org/bad.html");
exit;
}
$uploadFile = "/uploads/".$Photo_Name ;
if (!is_dir(dirname($uploadFile)))
{
@RecursiveMkdir(dirname($uploadFile));
}
else
{
@chmod(dirname($uploadFile), 0777);
}
@move_uploaded_file( $Photo_Temp , $uploadFile);
chmod($uploadFile, 0644);
$Photo_URL = "http://ldepadrinos.org/uploads/".$Photo_Name ;
The directory gets created, but the file never uploads.... could one of you gurus please let me know where the fault lies? THanks so much