Word documents renamed to .txt


I’m running into an issue with a journal in OJS When files are uploaded to the journal, they’re Word documents; however, the generated (?) file name ends in .txt.

Here’s what I see in the DB:

mysql> select file_name, file_type from article_files where article_id=1220;
| 1220-3458-1-SM.txt | application/vnd.openxmlformats-officedoc |
| 1220-3459-1-RV.txt | application/vnd.openxmlformats-officedoc |
| 1220-3460-1-ED.txt | application/vnd.openxmlformats-officedoc |
| 1220-3461-1-RV.txt | application/vnd.openxmlformats-officedoc |
4 rows in set (0.00 sec)

Any suggestions would be welcome. Thanks.

The default extension of “txt” will be applied if one of the following is the case:

  • the uploaded file had no detectible extension
  • the original file extension contains the string “php”
  • the original file extension is longer than 6 characters
  • the original file extension is not a single word

See pkp-lib/FileManager.inc.php at ojs-dev-2_4 · pkp/pkp-lib · GitHub

Is there some reason that upgrading from a super-old version (1.x) would cause this as well? Because that’s what seems to have happened.

Hmmmm… that’s entirely outside of my experience. Are you saying that files existing in 1.x were “upgraded” to .txt extensions, or that only new uploads are affected?

Well, looking at the entries in my DB, it appears that the renaming – if that’s what happened – is inconsistent. I’m going to dig a little deeper.