Make WordPress Core

Changes between Version 3 and Version 4 of Ticket #28407, comment 5


Ignore:
Timestamp:
03/26/2015 12:43:00 PM (10 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #28407, comment 5

    v3 v4  
    44It is not possible to upload multiple file attachment.
    55It would be possible to change.
    6 
     6{{{
    77if ( !empty( $attachments ) ) {
    8                 foreach ( $attachments as $attachment ) {
    9                         try {
    10                                 if(is_array($attachment)){
    11                                         list($name, $file) = each($attachment);
    12                                         $phpmailer->AddAttachment($file, $name);
    13                                 }else{
    14                                         $phpmailer->AddAttachment($attachment);
    15                                 }
    16                         } catch ( phpmailerException $e ) {
    17                                 continue;
     8        foreach ( $attachments as $attachment ) {
     9                try {
     10                        if(is_array($attachment)){
     11                                list($name, $file) = each($attachment);
     12                                $phpmailer->AddAttachment($file, $name);
     13                        }else{
     14                                $phpmailer->AddAttachment($attachment);
    1815                        }
     16                } catch ( phpmailerException $e ) {
     17                        continue;
    1918                }
    2019        }
    21 
     20}
     21}}}
    2222
    2323
    2424Exemple:
    25 
     25{{{
    2626$attachments[] = array(
    27                                         $_FILES[arquivo][name] => $_FILES[arquivo][tmp_name],
    28                                 );
     27        $_FILES[arquivo][name] => $_FILES[arquivo][tmp_name],
     28);
     29}}}