Unable to Send Multiple files to email using the following Code
<p>I am using this code to send multiple file to email but only one file is attached to mail and all files are uploaded to server.
    Can any one suggest how to solve this problem.</p>

<pre><code>    $to =  'rajeshgoud6785@gmail.com';
    $subject =  'PHP Mail Attachment Test';
    $bound_text = "UTSIp123";
    $bound = "--".$bound_text."\r\n";
    $bound_last = "--".$bound_text."--\r\n";
     $file_name=$_FILES['filea']['name'];
        $temp_name=$_FILES['filea']['tmp_name'];

        //copy($temp_name,$imagespath);
        $path=str_replace("mail.php","",$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
        $headers = "From: test@universalutsi.com\r\n";
        $headers .= "MIME-Version: 1.0\r\n"
        ."Content-Type: multipart/mixed; boundary=\"$bound_text\"";

        $message .= "If you can see this MIME than your client doesn't accept MIME types!\r\n"
          .$bound;

        $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n"
          ."Content-Transfer-Encoding: 7bit\r\n\r\n"
          ."Welcome to rajesh\r\n"
            .$bound;
&lt;Code&gt;/* To Attacb Muiltiple files to a Mail */ &lt;/code&gt;      
        for($i=0;$i&lt;count($_FILES["filea"]["name"]);$i++)
        {
            echo $imagespath[$i]="images1/".$file_name[$i];
            copy($temp_name[$i],$imagespath[$i]);
            //echo $file_name[$i]."&lt;br/&gt;";
            $file[$i] = file_get_contents("http://".$path."images1/".$file_name[$i]);//."/images1/".$file_name);
            //echo"&lt;pre&gt;";print_r($file);
            $message .= "Content-Type: application/octet-stream; name=\"".$file_name[$i]."\"\r\n"
              ."Content-Transfer-Encoding: base64\r\n"
              ."Content-Disposition: attachment; file=\"regal_004.jpg\"\r\n"
              ."\r\n"
              .chunk_split(base64_encode($file[$i]))
              .$bound_last;


    } 
mail($to, $subject, $message, $headers);
</code></pre>

<p>Thanks in Advance</p>

<p>Rajesh Goud</p>
