Hi Guys
Hope someone can help me.
To explain briefly i have a form that which allows for multiple uploads. The form works fine and the prcoess works through to the end of however the one issue. There is only 1 attachment (Always the first one) in the e-mail even though I can clearly see that it has each file in the array.
I am using a for loop to go through each file and add it to the headers (See Below)
[php] foreach($files as $file){
$handle = fopen($destination.$file, "r");
$content = fread($handle, filesize($destination.$file));
fclose($handle);
$attachment = chunk_split(base64_encode($content));
$headers .= "Content-Type:".$types[$x]."; ";
$headers .= "name=\"".$file."\"\r\n";
$headers .= "Content-Transfer-Encoding:base64\r\n";
$headers .= "Content-Disposition:attachment; ";
$headers .= "filename=\"".$file."\"\r\n";
$headers .= "X-Attachment-Id:".rand(1000,9000)."\r\n\r\n";
$headers .= $attachment."\r\n";
$headers .= "--".md5('boundary')."--";
} [/php]
For example the if i output the $files in the for loop i get the following
[php]1.jpg2.png[/php]
However it will not attach both files as an attachment!
Can anywhere please advise why this could be?