Can anyone help me with the code why it is wrong . What Should i need to do to correct. Thank for your help . Pls help me

if (is_uploaded_file($fileatt3)) {
    $file = fopen($fileatt3,'rb');
    $data = fread($file,filesize($fileatt3));
    fclose($file);
   
    $semi_rand = md5(time());
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
   
     $data = chunk_split(base64_encode($data));
   
    $body .= "--{$mime_boundary}\n" .
    "Content-Type: {$fileatt3_type};\n" .
    " name=\"{$fileatt3_name}\"\n" .
    "Content-Transfer-Encoding: base64\n\n" .
    $body . "\n\n" .
    "--{$mime_boundary}--\n";
}

if (is_uploaded_file($fileatt2)) {
    $file = fopen($fileatt2,'rb');
    $data = fread($file,filesize($fileatt2));
    fclose($file);
   
  
    $semi_rand = md5(time());
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
   
     $data = chunk_split(base64_encode($data));
   
    $body .= "--{$mime_boundary}\n" .
    "Content-Type: {$fileatt2_type};\n" .
    " name=\"{$fileatt2_name}\"\n" .
    "Content-Transfer-Encoding: base64\n\n" .
    $body . "\n\n" .
    "--{$mime_boundary}--\n";
}
Member Avatar for andre.vanzuydam

You'll need to post your code with code tags so we can see what you are trying to do.

I normally use file_get_contents for reading file data in PHP and PHPMailer for sending emails. Your file input name should contain [] which will create an array of when posting which should be easier to work with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.