Hi,
we have a problem with users sending binary attachments, such as word documents. I investigated this today and found that the saved attachment file is ok, only the delivery through the staff interface causes the problems.
Here is what I did:
First I send a text file as attachment and viewed it in the new ticket. It worked without any problem.
Next I send a Word document, having the same dummy text as content. Trying to download this from the ticket view returns just some data that is not recognized as word document. Lokking at it with a text editor shows the text content though, somewhere after a lot of binary stuff (like normal for a word doc, but still it is none).
The attachments were saved to db, so I changed it to filesystem to easier inspect the saved files. After checking the base64 encoded data from the mail (parser log), that was still correct, I downloaded the saved attachment from the files folder. I renamed it and it worked.
Downloading it through the staff interface still failed.
Next I wrote a small php file that does the same as the dispatchAttachment function used to send out attachments to the browser. Here is how it looks like:
PHP Code:
<?php
header("Content-Type: application/msword" . "\r\n");
header("Content-Disposition: attachment; filename=\"". "testdummy2.doc" ."\"");
$fp = fopen("./files/attach_e6157855429e03591637e0c738e5199c", "rb");
if (!$fp)
{
return false;
}
while(!feof($fp)) {
echo fread($fp, 8192);
flush();
}
fclose($fp);
?>
It does practically the same as the esupport function, only without the overhead to look for the attachment and so. This works.
The staff interface getting this file returns just binary ****.
I also looked at the send and received headers, they are nearly the same, except for data that should be different.
I noticed that the function sets the transfer-encoding to binary, my code did not. I changed this so esupport sends chunked as encoding, but still no difference.
Now I have no more idea what could be the problem.
Anybody else has an idea or met the same problem? Or should I post this to esupport support for help?