I am using the below script to allow user to upload images and email it to me. I did received the email but there is no attachment. It also show the from email as root user instead of the user's email address. please help.

PHP Code:
<?php
    ob_start
();
    require(
"class.phpmailer.php");
    
    
$salutation        $_POST['salutation'];
        
$firstname         $_POST['firstname'];
        
$lastname          $_POST['lastname'];
        
$email             $_POST['email'];
        
$photo             $_FILES['photo'];
    
    isset(
$_POST['submit']);
    
$active_keys = array();
    foreach(
$_FILES[$photo]['name'] as $key => $filename)
    {
    if(!empty(
$filename))
    {
        
$active_keys[] = $key;
    }    }
    
foreach(
$active_keys as $key)
{    switch(
exif_imagetype($_FILES[$photo]['tmp_name'][$key])) {
    case 
IMAGETYPE_JPEG:
    case 
IMAGETYPE_PNG:
        break;
    default:
        echo 
"{";
        echo        
"error: 'This is no photo..'\n";
        echo 
"}";
        exit(
0);
} }
    
$message "Photo submitted by: $salutation $firstname $lastname.  <br>Comments: $comments.<br>terms:$terms.";
   
    
$mail = new PHPMailer();
   
    
$mail->From     = ($email);
    
$mail->AddAddress('info@domain.com');

    
$mail->Subject  "Submitted Photos";
    
$mail->Body     $message;
    
$mail->WordWrap 50;

    foreach(
$FILES['photo']['tmp_name'] as $photo) {
    if(!empty(
$photo)) {
        
$mail->AddAttachment($photo);
    }}

    
$mail->Send();
    
    
header("Location: thankyou.php");
       exit();     
    
?>