PHPMailer attachment type and size limit

Posted by SomeoneS on Stack Overflow See other posts from Stack Overflow or by SomeoneS
Published on 2012-06-08T10:34:46Z Indexed on 2012/06/08 10:40 UTC
Read the original article Hit count: 266

Filed under:
|

i have one form and i am using PHPMailer to send data from that form to my email. Users can send attachments as well, but i have one rpoblem: how to make PHPMailer to deny attachments larger than 2Mb and to allow only iamge attachments (no other types of documents)?

This is code i using for multiply email attachments with PHPMailer:

foreach(array_keys($_FILES['fileAttach']['name']) as $key) {

   $source = $_FILES['fileAttach']['tmp_name'][$key]; 
   $filename = $_FILES['fileAttach']['name'][$key]; 

   $mail->AddAttachment($source, $filename);

}

© Stack Overflow or respective owner

Related posts about php

Related posts about phpmailer