Home » Mail » Mail_mimeDecode » Bug #4739
Mail_MimeDecode: d_parameters['filename'] missing
Details
| Submitted | 2005-07-04 14:56 UTC |
|---|---|
| From | cm at data-consult dot de |
| Assigned | alan_k |
| Status | Closed |
| Package | Mail_mimeDecode |
| PHP Version | 4.3.10 |
| OS | Debian Sarge |
| Roadmaps | 1.6.0 |
Comments
[2005-07-04 14:56 UTC] cm at data-consult dot de
Description:
------------
Sometimes the d_parameters['filename'] or ['name'] is missing with the attachment. this happens with utf8 encoded filenames(mostly from M$ clients it seems). without filename im unable to save the file. below is the samplecode i use to save the attachments. i have a testsuite with about 900 mails and this problem exists with more than 10% of these.
i've tried this with and without utf8_decode, but the variables are always empty.
Reproduce code:
---------------
if (isset($part->disposition) and ($part->disposition=='attachment')) {
printf(utf8_decode($part->ctype_parameters['name'])."\n");
printf(utf8_decode($part->ctype_parameters['filename'])."\n");
$attachmentfile = fopen($datedir."/".utf8_decode($part->ctype_parameters['name']), 'w');
fwrite($attachmentfile, $part->body);
fclose($attachmentfile);
}
Expected result:
----------------
this is the print_r($part):
stdClass Object
(
[headers] => Array
(
[content-type] => application/PDF
[content-disposition] => attachment; filename="Auftragsbestätigung_SO_1312338.pdf"
[content-transfer-encoding] => base64
)
[ctype_primary] => application
[ctype_secondary] => PDF
[disposition] => attachment
[d_parameters] => Array
(
[filename] => Auftragsbestätigung_SO_1312338.pdf
)
[body] => %PDF-1.4M%âãÏÓM
so the filename parameter is there.
Actual result:
--------------
but when i use
printf($part->ctype_parameters['filename']."\n");
this variable is empty.
[2005-12-16 23:42 UTC] chris at deskpro dot com
I am coming across this problem as well, however in the cases where I find this missing I am finding a ctype_paramters that has the name in it.
I am finding this problem on inline attachments in Outlook (e.g. background images).