cjay175 0 Light Poster

I wasw ondering if someone could help me out with attaching multiple files to an email using uploadify and contact form.

So far I have the file locations and names put into an array

<input type="hidden" name="file_name[]" value="/uploads/'+response+'" />

How would I attach these files to an email through php.

Thanks a lot

So far this is my php script I have been playiung with

<?php 
$yourEmail = "support@mydomain.info";
$emailSubject = 'Company - Contact Page Mail';

$fname = $_POST{"fname"};
$email = $_POST{"email"};
$busname = $_POST{"busname"};
$phone = $_POST{"phone"};
$message = $_POST{"message"};
$contact = $_POST{"contact"};
$contactphone = $_POST{"contactphone"};
$ext = $_POST{"ext"};
$message = $_POST{"message"};


$files = array($_POST{"file_name[]"});


// boundary
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// headers for attachment
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
// multipart boundary
$message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n";
$message .= "--{$mime_boundary}\n";
// preparing attachments
for($x=0;$x<count($files);$x++){
$file = fopen($files[$x],"rb");
$data = fread($file,filesize($files[$x]));
fclose($file);
$data = chunk_split(base64_encode($data));
$message .= "Content-Type: {\"application/octet-stream\"};\n" . " name=\"$files[$x]\"\n" .
"Content-Disposition: attachment;\n" . " filename=\"$files[$x]\"\n" .
"Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";
$message .= "--{$mime_boundary}\n";
}

$message .= <<<EOD
<br><hr><br>
Full Name: $fname <br>
Email: $email <br>
Business Name: $busname <br>
Phone: $phone <br>
Preferred Contact: $contact <br>
Preferred Contact Phone: $contactphone - $ext <br>
Message:<br>$message<br>
EOD;
// send
$ok = @mail($yourEmail, $emailSubject, $message, $headers);
if ($ok) {
echo "<p>mail sent to $yourEmail!</p>";
} else {
echo "<p>mail could not be sent!</p>";
}
?>

I was trying this but I suppose because I am using uploadify jquery plugin I would need to use a link or url to attach the files.

Thanks again