email - Attach Two Files PHP -


i have gotten script send 1 file through email have been asked make can accept two.

my script far looks like.

// obtain file upload vars $fileatt      = $_files['file1']['tmp_name']; $fileatt_type = $_files['file1']['type']; $fileatt_name = $_files['file1']['name'];   if (is_uploaded_file($fileatt)) {     $file = fopen($fileatt,'rb');   $data = fread($file,filesize($fileatt));   fclose($file);    $semi_rand = md5(time());   $mime_boundary = "==multipart_boundary_x{$semi_rand}x";    $headers .= "\nmime-version: 1.0\n" .               "content-type: multipart/mixed;\n" .               " boundary=\"{$mime_boundary}\"";    $message = "this multi-part message in mime format.\n\n" .              "--{$mime_boundary}\n" .              "content-type: text/html; charset=\"iso-8859-1\"\n" .              "content-transfer-encoding: 7bit\n\n" .              $message . "\n\n";     $data = chunk_split(base64_encode($data));    $message .= "--{$mime_boundary}\n" .               "content-type: {$fileatt_type};\n" .               " name=\"{$fileatt_name}\"\n" .               //"content-disposition: attachment;\n" .               //" filename=\"{$fileatt_name}\"\n" .               "content-transfer-encoding: base64\n\n" .               $data . "\n\n" .               "--{$mime_boundary}--\n";  } 

i want able use these in head , able post through. have tried modifying script 1 file come through.

// obtain file upload vars $fileatt2      = $_files['file2']['tmp_name']; $fileatt_type2 = $_files['file1']['type']; $fileatt_name2 = $_files['file1']['name']; 

so have got 2 input fields in html

<input name="file1" type="file" /> <input name="file2" type="file" /> 

here woops

// obtain file upload vars $fileatt2      = $_files['file2']['tmp_name']; $fileatt_type2 = $_files['file1']['type']; $fileatt_name2 = $_files['file1']['name']; 

change 3 use file2

// obtain file upload vars $fileatt2      = $_files['file2']['tmp_name']; $fileatt_type2 = $_files['file2']['type']; $fileatt_name2 = $_files['file2']['name']; 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -