Hello everyone I am trying to see if I can receive multiple photos at once from my contact php form to my thunderbird email when I go to my contact php form I click choose files and I highlight the photos that I want to send it would show 13 photos that has been selected and then I submitted form with those photos then I checked my thunderbird email and I only received one photo. I have attached 2 screenshots of my contact form with the 13 photos selected and email that I received with the one photo attachment plus I have included the php code from the contact form any idea as what might be problem for this any help and solutions is greatly appreciated thanks very much in advance.
<?PHP
/*
Contact Form from HTML Form Guide
This program is free software published under the
terms of the GNU Lesser General Public License.
See this page for more info:
http://www.html-form-guide.com/contact-form/contact-form-attachment.html
*/
require_once("./include/fgcontactform.php");
$formproc = new FGContactForm();
//1. Add your email address here.
//You can add more than one receipients.
$to = $formproc->AddRecipient('test@alphaboss.ca'); //<<---Put your email
address here
$subject = 'Form was submitted';
$message = 'New message from a visitor';
$headers = 'From: test@alphaboss.ca' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers); // 'test@alphaboss.ca', 'Form was
submitted', 'New message from a visitor'
//2. For better security. Get a random tring from this link:
// and put it here
$formproc->SetFormRandomKey('HG9hPBpn9Bn26yg');
$formproc->AddFileUploadField('photo','jpg,jpeg,gif,png,bmp',2024);
if(isset($_FILES ['name']))
if(isset($_FILES ['photo']))
if(count($_FILES['name']['photo'])) {
foreach ($_FILES['name']['photo'] as $file) {
// Count total files
$formproc = count($_FILES['photo']['name']);
}
// Looping all files
for($i=0;$i<$fromproc;$i++){ $file = $_FILES['photo']['name'][$i];
}
// Upload file
move_uploaded_file($_FILES['photo']['tmp_name'][$i],'submit/'.$file);
//do your upload stuff here
echo $file;
}
}
if(isset($_POST['submitted']))
{
if($formproc->ProcessForm())
{
$formproc->RedirectToURL("thank-you.php");
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<title>Alpha Boss Computer Services</title>
<style>
body {font-family: Verdana, sans-serif;
margin: 0;
}
h1 {text-align:center;
color: navy;
}
#background-image {
background-image: url(alpha.png);
width: 100%;
top: 0;
left: 0;
height:100%;
opacity: 0.2;
position: absolute;
background-repeat: repeat;
padding: 0;
margin: 0;
z-index:0;
}
.navbar {
overflow: hidden;
background-color: #333;
position: fixed;
bottom: 0;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.navbar a {
display: inline-block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
margin: 0px auto;
}
.navbar a:hover {
background: #f1f1f1;
color: black;
}
.fieldset-auto-width {
display: inline-block;
}
form {
position: absolute;
z-index: 2;
left: 50px;
right: 50px;
}
</style>
<link rel="STYLESHEET" type="text/css" href="contact.css" />
<script type='text/javascript' src='scripts/gen_validatorv31.js'></script>
<script type='text/javascript' src='scripts/fg_captcha_validator.js'>
</script>
<link rel="icon" href="http://localhost/alpha.png" type="image/png"
sizes="16x16">
</head>
<body>
<div id="background-image"></div>
<!-- Form Code Start -->
<center><form id='contactus' action='<?php echo $formproc->GetSelfScript();
?>' method='post' enctype="multipart/form-data" accept-charset='UTF-8'>
<fieldset class="fieldset-auto-width">
<legend><h1>Contact Alpha Boss Computer Services</h1></legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<input type='hidden' name='<?php echo $formproc->GetFormIDInputName(); ?>'
value='<?php echo $formproc->GetFormIDInputValue(); ?>'/>
<input type='text' class='spmhidip' name='<?php echo $formproc-
>GetSpamTrapInputName(); ?>' />
<div class='short_explanation'><font size="3" color="navy"><h1>* required
fields</h1></font></div>
<div><span class='error'><?php echo $formproc->GetErrorMessage(); ?></span>
</div>
<div class='container'>
<label for='name'><font size="3" color="navy"><h1>Your Full Name Below*:
</h1></font></label><br/>
<input style='width:400px;height:40px;font-size:14pt; border:3px solid
black' type='text' name='name' id='name' value='<?php echo $formproc-
>SafeDisplay('name') ?>' maxlength="50" /><br/>
<span id='contactus_name_errorloc' class='error'></span>
</div>
<div class='container'>
<label for='email'><font size="3" color="navy"><h1>Your Email Address
Below*:</h1></font></label><br/>
<input style='width:400px;height:40px;font-size:14pt; border:3px solid
black' type='text' name='email' id='email' value='<?php echo $formproc-
>SafeDisplay('email') ?>' maxlength="50" /><br/>
<span id='contactus_email_errorloc' class='error'></span>
</div>
<div class='container'>
<label for='message'><font size="3" color="navy"><h1>Your Message Below:
</h1></font></label><br/>
<span id='contactus_message_errorloc' class='error'></span>
<textarea rows="10" cols="50" name='message' id='message' style="border:3px
solid black"><?php echo $formproc->SafeDisplay('message') ?></textarea>
</div>
<div class='container'>
<label for='photo'><font size="3" color="navy"><h1>Upload your photos:</h1>
</font></label><br/>
<input type="file" name='photo[]' id='photo' multiple=""/><br/>
</div>
<div class='container'>
<input type='submit' name='Submit' value='Submit' />
</div>
</fieldset>
</form></center>
<h1>You can call <u>289-696-7530</u></h1>
<div class="navbar">
<div class="navbar-inner">
<a href="index.html">HOME</a>
<a href="https://www.facebook.com/Alpha-Boss-Computer-Services-
1259286717548256/">FACEBOOK PAGE</a>
</div>
</div>
<!-- client-side Form Validations:
Uses the excellent form validation script from JavaScript-coder.com-->
<script type='text/javascript'>
// <![CDATA[
var frmvalidator = new Validator("contactus");
frmvalidator.EnableOnPageErrorDisplay();
frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("name","req","Please provide your name");
frmvalidator.addValidation("email","req","Please provide your email
address");
frmvalidator.addValidation("email","email","Please provide a valid email
address");
frmvalidator.addValidation("message","maxlen=2048","The message is too long!
(more than 2KB!)");
frmvalidator.addValidation("photo","file_extn=jpg;jpeg;gif;png;bmp","Upload
images only. Supported file types are: jpg,gif,png,bmp");
// ]]>
</script>
</body>
</html>
@Wr1t3r this is my updated fgcontactform.php code I hope that this helps better for you to understand. I also got the contact form from http://www.html-form-guide.com/contact-form/contact-form-attachment.html.