mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
"Fixes #4416, Email component uses invalid \"Content-Type\" for attachments.
Added fclose(); Removed unused code" git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6623 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
c9a6fa7f9f
commit
358c529e7a
1 changed files with 2 additions and 6 deletions
|
@ -518,14 +518,10 @@ class EmailComponent extends Object{
|
|||
$handle = fopen($file, 'rb');
|
||||
$data = fread($handle, filesize($file));
|
||||
$data = chunk_split(base64_encode($data)) ;
|
||||
$info = pathinfo($file);
|
||||
$filetype = 'unknown';
|
||||
if (isset($info['extension'])) {
|
||||
$filetype = $info['extension'];
|
||||
}
|
||||
fclose($handle);
|
||||
|
||||
$this->__message .= '--' . $this->__boundary . $this->_newLine;
|
||||
$this->__message .= 'Content-Type: ' . $filetype . '; name="' . basename($file) . '"' . $this->_newLine;
|
||||
$this->__message .= 'Content-Type: application/octet-stream' . $this->_newLine;
|
||||
$this->__message .= 'Content-Transfer-Encoding: base64' . $this->_newLine;
|
||||
$this->__message .= 'Content-Disposition: attachment; filename="' . basename($file) . '"' . $this->_newLine . $this->_newLine;
|
||||
$this->__message .= $data . $this->_newLine . $this->_newLine;
|
||||
|
|
Loading…
Reference in a new issue