Ticket #1484256: full-attachments.diff

File full-attachments.diff, 1.0 kB (added by mankytongue, 21 months ago)
  • program/steps/mail/get.inc

     
    109109    else 
    110110      { 
    111111      // turn off output buffering and print part content 
    112       $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part->encoding, true); 
     112 
     113               //File download hack 
     114               //Create tmp 
     115               $filepath = tempnam("/tmp",'roundcube_attachment'); 
     116 
     117               $fh = fopen($filepath,'w'); 
     118 
     119               fwrite($fh,$IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part->encoding, false)); 
     120       fclose($fh); 
     121 
     122               //Send filesize to browser 
     123 
     124               header(sprintf("Content-Length: %s",filesize($filepath))); 
     125 
     126 
     127               //Send Contents of file 
     128               readfile($filepath); 
     129 
     130               //Remove tmp 
     131               unlink($filepath); 
    113132      } 
    114133 
    115134    exit;