Corrupt Word Docs! HELP PLEASE!

Corrupt Word Docs! HELP PLEASE!

by George Morris -
Number of replies: 11

Hi,

We just upgraded to Moodle 2.5, and all was going so well, until we began getting reports that ALL Word Docs (.doc, .docx, .xlsx, .xls, etc) are coming up with a message that says "Word detected unreadable content in the file, click ok to recoever, blah blah"... No matter what we do, the issue continues. It is happening across the board, for Teachers and Students alike. The files are NOT corrupt before uploading. But when clicking the links through Moodle, they get corrupted somehow?

Also, I have searched the entire Moodle Website for answers... and have not found one...

Please help.
Thank You smile

Average of ratings: -
In reply to George Morris

Re: Corrupt Word Docs! HELP PLEASE!

by Guillermo Madero -

Hi George,

How are you uploading the files, through Moodle or via FTP to a repository? FTP has to be set to binary mode when doing transfers. If you download (right click and save as...) a document and compare it with the original, do you actually have any differences? Did you (or anyone else) change anything at all at the web server configuration file? Could it be a MIME setting issue? Have you checked for virus?

 

By the way, it is best to avoid all-caps texts.

 

In reply to Guillermo Madero

Re: Corrupt Word Docs! HELP PLEASE!

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

another guess could be that you have a closing php tag at the end of your config.php with an extra carriage return after it...

In reply to Guillermo Madero

Re: Corrupt Word Docs! HELP PLEASE!

by George Morris -

Thank You guys for the fast replies!

We are uploading through Moodle, not ftp.
And I double-checked mime types. They are correct in both, Moodle lib.php and in IIS config.
And I checked the config.php file for carriage returns or closing tags... All is good.

There is a 10 byte difference between the original and the one downloaded from Moodle using the the "Save As".

The original is 10 bytes less in size.

In reply to George Morris

Re: Corrupt Word Docs! HELP PLEASE!

by Ken Task -
Picture of Particularly helpful Moodlers

What filters do you have turned on? and in what order are they?

Got all the required mods for php ... especially of the php-xml flavors?

Upload a docx to your moodle code root via FTP (binary).

Hit it with a browser.  Same thing?

Rather than trying to open a .docx, copy it to a test folder, change the extension to .zip and unzip it.   Does it unzip cleanly?  If so, also poke around the .xml files in there.

'spirit of sharing', Ken

In reply to George Morris

Re: Corrupt Word Docs! HELP PLEASE!

by Guillermo Madero -

Hi George,

Always 10 bytes? In all files or would that number change depending on the file extension. Have you hex-compared the files. Maybe those 10 bytes are always the same and that would help determine how they get inserted into the files. I'm kind of leaning toward a possible virus or malware problem.

In reply to Guillermo Madero

Re: Corrupt Word Docs! HELP PLEASE!

by George Morris -

Wow, I'm very impressed with everyone's willingness to pitch in and help in this forum smile

I just registered today, and this was my first question/issue.
Thanks to everyone that responded.

The problem is resolved.
I just downloaded the latest weekly build of Moodle (2.5.1), backed up all our data, deleted everything in the Moodle directory, and performed the install/update with the new download.
Everything worked perfect after the re-installation.
I assume it was a corrupt *.php config file somewhere in the Moodle configs.
Wish I new which one/ones...

But I couldn't spend anymore time on it.

Thanks again for all your help guys!

In reply to George Morris

Re: Corrupt Word Docs! HELP PLEASE!

by Shivanesh Lal -

Hey Guys has any one able to get this issue solved apart from upgrading is there any other way we can get this working ? Please Help .


I am using Moodle 2.7, are able to upload doc files successful but when downloading the same files it gets corrupted any help please ?? 

In reply to Shivanesh Lal

Re: Corrupt Word Docs! HELP PLEASE!

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Your issue may be different, even if the result is the same. Have you compared the file sizes? Do you have the same 10 byte change in size? Was it working then stopped? Have you still got the original files, or do you only have the ones uploaded? Are the original OK or are they corrupt too? Better look I suggest. 

My early suspicion would be that the php files that handle downloads have not been properly loaded in the core code base, and as I don't know which specific file or files that may be, better off replacing all with an update of the Moodle. try a 2.7.5+, being the latest in that range. There should not be too much of a drama, to replace the files, just make sure your existing config.php file is clean and not overwritten. (Copy it off somewhere else, open it in a UTF-8 compliant editor, like Vi or Notepad++ in Windows  or similar in Mac, and try to delete everything after the last line of text, or any other characters that do not relate to the code or the Moodle. Such an update refreshes everything and if handled correctly, the post-update testing will take longer than the update itself.

In reply to Colin Fraser

Re: Corrupt Word Docs! HELP PLEASE!

by Shivanesh Lal -

The file size is same as the original file while uploaded, 

Yes it was working before then now it has stopped, i have got the original files with me and they are not corrupted.  

In reply to Shivanesh Lal

Re: Corrupt Word Docs! HELP PLEASE!

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Then something is interfering with the download. Check the server logs, if you have access to them, otherwise ask the ISP or network manager, check the Moodle Logs as well. However, it is unlikely that an error will be detected there, so upgrading is the safest way of fixing these kinds of problems, unless it has something to do with the download protocols, which is well outside Moodle. Good luck...   

In reply to Colin Fraser

Re: Corrupt Word Docs! HELP PLEASE!

by Shivanesh Lal -

hey sorry for not mentioning moodle is on localhost