PHP form mail script and uploader

I am using a form mail script that emails and uploads files to my webserver.
The info that is emailed is the information placed in the html input fields and the file names that were uploaded.

Within the form I am wanting the user to upload 6 files along with filling out the form info.

The issue I am having is that the form works in different ways at times when people have tried to use it.

  1. Works correctly and files are uploaded
  2. Emails the form but no file names are listed
  3. Emails the form no file names listed and repeats the email numerous times
  4. Emails the form no file names listed but sends another email with file names listed

I figured it had to do something with the file size, so I have ran numerous test uploading files that are under a mb in size to ones that are up to 10 mbs.
I have had it time out on me when the files I was uploading were very large in size.

Below is the script:
[php]

<?php require "class.phpmailer.php"; // Defime posted variables $bridename = $_POST['bridename'] ; $groomname = $_POST['groomname'] ; $weddingdate = $_POST['weddingdate'] ; $mailingaddress = $_POST['mailingaddress'] ; $phone = $_POST['phone'] ; $email = $_POST['email'] ; // Box 1 $box1file1 = $_FILES["box1file1"]["name"] ; $box1file2 = $_FILES["box1file2"]["name"] ; $box1file3 = $_FILES["box1file3"]["name"] ; $box1file4 = $_FILES["box1file4"]["name"] ; $box1file5 = $_FILES["box1file5"]["name"] ; $box1file6 = $_FILES["box1file6"]["name"] ; // Upload Script //if ((($_FILES["file"]["type"] == "image/gif") //|| ($_FILES["file"]["type"] == "image/jpeg") //|| ($_FILES["file"]["type"] == "image/pjpeg") //|| ($_FILES["file"]["type"] == "image/jpg")) //&& ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "
" ; } else { //if (file_exists("uploads/" . $file)) { if (file_exists("register/" . $box1file1 && $box1file2 && $box1file3 && $box1file4 && $box1file5 && $box1file6)) { echo $box1file1 . " already exists. " ; echo $box1file2 . " already exists. " ; echo $box1file3 . " already exists. " ; echo $box1file4 . " already exists. " ; echo $box1file5 . " already exists. " ; echo $box1file6 . " already exists. " ; error_reporting(0); //echo ""; //error_reporting(0); } else { move_uploaded_file($_FILES["box1file1"]["tmp_name"],"register/" . $box1file1); copy($_FILES["box1file2"]["tmp_name"],"register/" . $box1file2); copy($_FILES["box1file3"]["tmp_name"],"register/" . $box1file3); copy($_FILES["box1file4"]["tmp_name"],"register/" . $box1file4); copy($_FILES["box1file5"]["tmp_name"],"register/" . $box1file5); copy($_FILES["box1file6"]["tmp_name"],"register/" . $box1file6); } } } //else //{ //echo "Invalid file"; //} // End Upload Script if (!isset ($bridename, $groomname, $mailingaddress, $phone, $email)) { header("Location: http://www.mywebsite.com/formtest.html"); } else { $message = "Bride's Full Maiden Name: $bridename\r\n" . "Groom's Full Name: $groomname\r\n" . "Wedding Date: $weddingdate\r\n" . "Couple's Mailing Address: $mailingaddress\r\n" . "Phone: $phone\r\n" . "Email: $email\r\n" . "Pictures: $box1file1, $box1file2, $box1file3, $box1file4, $box1file5, $box1file6\r\n\r\n" . "$cover\r\n" ; $mail = new PHPMailer(); $mail->IsMail(); // set mailer to use SMTP $mail->From = "WV Weddings"; $mail->FromName = "$email"; $mail->AddAddress("[email protected]", "Tad Ward"); $mail->AddReplyTo("$email", "$bridename"); $mail->WordWrap = 50; // set word wrap to 50 characters $mail->IsHTML(false); $mail->UseMSMailHeaders = true; $mail->Subject = "6 Photo Entry Test "; $mail->Body = $message; if($mail->Send()) header("Location: http://www.mywebsite.com/thanks.php"); } ?>

[/php]

This is a script that was once just for emailing and I messed around with it to include the uploading.

What would be causing the issue at times?

Sponsor our Newsletter | Privacy Policy | Terms of Service