开发者

MS Office no longer works as BLOB

开发者 https://www.devze.com 2022-12-19 01:28 出处:网络
Hi does anyone know why MS Office such as doc, docx and xls can no longer be viewed when retrieved from a mysql db when stored as Bl开发者_JAVA百科ob?

Hi does anyone know why MS Office such as doc, docx and xls can no longer be viewed when retrieved from a mysql db when stored as Bl开发者_JAVA百科ob? The doc and docx used to download and open without any problem, but now it no longer recognises the file format.


I'd like to ditto your problem. Images and plain text files upload/download from mysql blob field. Doc and docx files seemed to be corrupted. I've read somewhere of a rumor of mysql truncating the last 4 bits but I can't verify that.


I have used xvi32 (a hex editor) to compare local originals of files with versions dowloaded from BLOB/LONGBLOB fields. It seems that extra bytes, which I think represent a CRLF are appended, as far as I can work out by Windows when the file is written. This doesn't seem to be a problem for some graphic formats which are to some extent fault-tolerant, but the office XML format files are corrupted by this extra data.

I have tried using ob_clean() and ob_flush() [that is, in php] before printing/echoing the file contents, but still corrupted as far as Office is concerned.

I know this is an old thread but I would appreciate any solutions anyone might have found since it was last updated.


Did you try with a short txt file instead of .doc and see if the contents are different than what you expected?

0

精彩评论

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

关注公众号