开发者

Corrupt PDF email attachment when generated by FPDF and PHP

I have a web application that builds a dynamic PDF with FPDF and allows you to download it. That works fine. When I try to email it to myself as a test instead of downloading, I get an email with a corrupt PDF attachme开发者_StackOverflownt.

I have tried the code from http://www.astahost.com/info.php/create-email-pdf-file-39on-fly39-php_t6334.html and http://www.daniweb.com/code/snippet217105.html but get the same result each time.

Has anyone come across this or know a way to fix it?


Your best way to get help here is to subset the full text headers and body of a received message, and place them in your question. Email is encoded, and not all email servers pass all types of encoding. The code you're using specifies "Content-Transfer-Encoding: base64".

Here's a valid JPG encoded with same:

--_eba07140-496e-4f3d-91ce-aff8afde8879_
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="DSC03538_AZ_atCape.JPG"

/9j/4Rt/RXhpZgAASUkqAAgAAAALAA4BAgAgAAAAkgAAAA8BAgAFAAAAsgAAABABAgAHAAAAuAAA
ABIBAwABAAAAAQAAABoBBQABAAAAwAAAABsBBQABAAAAyAAAACgBAwABAAAAAgAAADIBAgAUAAAA
....
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜