I'm attempting to send multiple files to my email but not are attaching properly. This is what I'm receiving:
Here is what my form looks like:
<form action="FILE-SENDING.php" enctype="multipart/form-data" method="POST">
<input type="text" name="name" placeholder="Name">
<input type="text" name="contact" placeholder="Contact">
<p>File 1:</p>
<input type="file" name="file1">
<p>File 2:</p>
<input type="file" name="file2">
<p>File 3:</p>
<input type="file" name="file3">
<button type="submit" value="Send File">Submit</button>
</form>
And my PHP:
<?php
$name = $_POST['name'];
$contact= $_POST['contact'];
$file1= $_FILES['file1'];
$file2= $_FILES['file2'];
$file3= $_FILES['file3'];
$to = "my@email.com";
$subject = "New Form Received!";
$txt =
"Name = ". $name .
"\r\n Contact = " . $contact .
"\r\n File 1 = " . $file1 .
"\r\n File 2 = " . $file2 .
"\r\n File 3 = " . $file3 ;
$headers = "From: noreply@email.com" . "\r\n" .
"CC: private-sender@gmail.com";
if($contact!=NULL){
mail($to,$subject,$txt,$headers);
}
header("Location:Success.html");
?>
I attempted different ways to integrate "$_FILES" but none landed a hit. Suspecting something may be missing on HTML, but not sure what.