script works but only sends one attachment. I can't seem to figure out what I'm doing wrong. It will send the first attachment $userfile['name'][0], but not $userfile['name'][1]
$i = 0;
foreach($_FILES as $userfile){
$tmp_name = $userfile['tmp_name'][$i];
$type = $userfile['type'][$i];
$name = $userfile['name'][$i];
$size = $userfile['size'][$i];
$i++;
}
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"
enctype="multipart/form-data" name="form1">
<input type="file" name="file[]" multiple />
original code is from here: How to attach two or multiple files and send mail in PHP