Potential Fix – Delivering Corrupt docx
-
Love the plugin, but we’ve been running into an issue lately in which viewing any docx (haven’t fully tested this with xlsx and pptx, but excel files have so far exhibited the same behavior) comes back as corrupted. We try to either open or save the file out and open it with Word, and we either see gibberish or the file appears to be completely corrupted. I’ve made sure that the mime type being delivered by the web server (apache) is correct, and I’ve even tried bumping that back down to the old mime type for regular doc files, and none of that worked. After a lot of googling, I’ve seen other users with this issue (a couple said that they had conflicting plugins and disabling them corrected the issue – no such luck for me).
I had also isolated a few other possibilities, such as a corrupt file to begin with, or an issue on upload (I pulled the uploaded & renamed file directly off of the server with FTP and hit the fully-qualified path to the file itself – both worked). Definitely something to do with when the file was being returned by the plugin.
What finally worked for me (not sure if this is worth including in the plugin in a future fix) was to clean the output buffering and run flush() right before the file is delivered (immediately before “read_file( $file)” in the “serve_file” function. Added the following 2 lines:
ob_clean();
flush();Hope this helps someone.
- The topic ‘Potential Fix – Delivering Corrupt docx’ is closed to new replies.