MS Office 不再作为 BLOB 工作

发布于 2024-08-20 05:21:28 字数 112 浏览 2 评论 0原文

大家好,有谁知道为什么从 mysql 数据库检索并存储为 Blob 时无法再查看 MS Office(例如 doc、docx 和 xls)吗? doc和docx以前下载打开没有任何问题,但现在不再识别文件格式。

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 Blob?
The doc and docx used to download and open without any problem, but now it no longer recognises the file format.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

酸甜透明夹心 2024-08-27 05:21:28

我想解决你的问题。从 mysql blob 字段上传/下载图像和纯文本文件。 Doc 和 docx 文件似乎已损坏。我在某处读到过有关 mysql 截断最后 4 位的谣言,但我无法验证这一点。

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.

残花月 2024-08-27 05:21:28

我使用 xvi32(十六进制编辑器)将文件的本地原始版本与从 BLOB/LONGBLOB 字段下载的版本进行比较。据 Windows 在写入文件时可以计算出的情况来看,似乎附加了额外的字节,我认为这些字节代表了 CRLF。对于某些在某种程度上具有容错能力的图形格式来说,这似乎不是问题,但是 Office XML 格式文件会被这些额外的数据损坏。

我在打印/回显文件内容之前尝试使用 ob_clean() 和 ob_flush() [即在 php 中],但就 Office 而言仍然损坏。

我知道这是一个旧线程,但我将不胜感激自上次更新以来任何人可能找到的解决方案。

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.

萌︼了一个春 2024-08-27 05:21:28

您是否尝试使用短 txt 文件而不是 .doc 并查看内容是否与您预期的不同?

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文