Answers.Body: <p>Thank you for adding the screenshot - it makes the issue much clearer.  I actually haven't used this feature before and it seems to be undocumented :(  That said, I was able to use it successfully on my local install.</p>
  
  <p>While this might be a bug you're seeing, I looked at the code and am suspecting a MIME misconfiguration in the website software settings.  To help track down which it is, I recommend editing the file at <code>&lt;civiroot&gt;/CRM/Admin/Form/MessageTemplates.php</code>.</p>
  
  <p>Find this line:
  <code>$errors['file_id'] = ts('Invalid document file format');</code></p>
  
  <p>Replace it with:
  <code>$errors['file_id'] = 'MIME type: ' . $files['file_id']['type'];</code></p>
  
  <p>The acceptable values are:</p>
  
  <ul>
  <li>docx: <code>application/vnd.openxmlformats-officedocument.wordprocessingml.document</code></li>
  <li>odt: <code>application/vnd.oasis.opendocument.text</code></li>
  </ul>
  
  <p>If you're getting a different value, hopefully it will provide a helpful clue as to the problem.  If not, please edit the question again to show the error you're getting.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-20T05:57:15.333Z
Answers.Text: I just successfully uploaded your document as a message template.  So I would definitely check for MIME type issues with your webserver!
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-28T17:09:52.133Z
Answers.Text: Thanks @Jon G, I'm still having trouble with templates. I've edited MessageTemplates.php as per your suggestions above and I'm still getting an error.  "MIME type: application/octet-stream" My mime types are set up exactly as you describe above. Any suggestions?
Answers.UserDisplayName: Stephen Sloan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-19T20:01:20.573Z
Answers.LastActivityDate: 2018-12-19T20:01:20.573Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>Based on your comment on my other answer, the issue is that your web browser is setting the MIME type incorrectly to <code>application/octet-stream</code>, which basically means "unknown file type".  While detailed answers exist on <a href="https://stackoverflow.com/questions/1201945/how-is-mime-type-of-an-uploaded-file-determined-by-browser">how browsers determine MIME type</a>, the short answer is to see if you can isolate the problem to a particular operating system, browser, etc.</p>
  
  <p>As a fallback, you can simply delete the line I suggested you modify in my other answer - it's very likely this will cause things to start working.  However, this isn't a great long-term answer, if for no other reason than you'll need to apply the fix every time you upgrade.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-28T23:12:40.110Z
Answers.Text: Thanks @Jon G, I can confirm that the same problem occurs on both Windows and ChromeOS using the Chrome browser. I'll have to load up another browser to see if it is browser based.
Answers.UserDisplayName: Stephen Sloan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-29T01:14:03.627Z
Answers.Text: Tried Firefox, same result. I'll try deleting that line.
Answers.UserDisplayName: Stephen Sloan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-29T01:37:29.857Z
Answers.Text: OK, was able to "upload" using FF under Linux. No joy though, the contents of the file were not added to the template.
Answers.UserDisplayName: Stephen Sloan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-29T02:12:41.873Z
Answers.Text: OK, so I had to update the registry entry for docx to add Content Type = application/vnd.openxmlformats-officedocument.wordprocessingml.document and now it works.
Answers.UserDisplayName: Stephen Sloan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-28T20:05:59.500Z
Answers.LastActivityDate: 2019-01-28T20:17:10.113Z
Answers.LastEditDate: 2019-01-28T20:17:10.113Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I can no longer upload docx or odt files to use as templates. Not sure when it happened but I'm running 5.6.0. I had uploaded files previously and even when downloading that same file and trying to upload again I get the error. Is it possibly a directory permissions issue? Confused... Not sure where to. Turning on debugging give no additional information. Thanks.</p>
  
  <p>Attached is a screen shot of when I try to save and the <a href="https://i.sstatic.net/l0Lvy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/l0Lvy.png" alt="enter image description here"></a></p>
  
  <p>and a Link to the bare .docx (stripped tokens)</p>
  
  <p><a href="https://morekidsonbikes.org/wp-content/uploads/2018/12/NICL_Thank_You_Letter-word.docx" rel="nofollow noreferrer">message template</a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-03T21:04:26.500Z
Comments.Text: Update to the latest release and see if that cures the problem.
Comments.UserDisplayName: Tony Horrocks
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-13T04:57:18.027Z
Comments.Text: There is an attempt to edit this post from another account with the same username. If you created a duplicate account (accidentally or because you lost access to the original one), please see https://civicrm.stackexchange.com/help/merging-accounts about merging them.
Comments.UserDisplayName: choster
Tags: <templates>
Title: Invalid document file format - error
ThreadText: # Invalid document file format - error
  
  (Asked by: username_0 on 2018-11-03)
  
  I can no longer upload docx or odt files to use as templates. Not sure when it happened but I'm running 5.6.0. I had uploaded files previously and even when downloading that same file and trying to upload again I get the error. Is it possibly a directory permissions issue? Confused... Not sure where to. Turning on debugging give no additional information. Thanks.
  
  Attached is a screen shot of when I try to save and the [![enter image description here](https://i.sstatic.net/l0Lvy.png)](https://i.sstatic.net/l0Lvy.png)
  
  and a Link to the bare .docx (stripped tokens)
  
  [message template](https://morekidsonbikes.org/wp-content/uploads/2018/12/NICL_Thank_You_Letter-word.docx)
  
  **Tags:** templates
  
  > **Comments:**
  > **username_1**: Update to the latest release and see if that cures the problem.  
  > **username_2**: There is an attempt to edit this post from another account with the same username. If you created a duplicate account (accidentally or because you lost access to the original one), please see https://civicrm.stackexchange.com/help/merging-accounts about merging them.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2018-12-19. Score: 1
  
  Thank you for adding the screenshot - it makes the issue much clearer. I actually haven't used this feature before and it seems to be undocumented :( That said, I was able to use it successfully on my local install.
  
  While this might be a bug you're seeing, I looked at the code and am suspecting a MIME misconfiguration in the website software settings. To help track down which it is, I recommend editing the file at `/CRM/Admin/Form/MessageTemplates.php`.
  
  Find this line:
  `$errors['file_id'] = ts('Invalid document file format');`
  
  Replace it with:
  `$errors['file_id'] = 'MIME type: ' . $files['file_id']['type'];`
  
  The acceptable values are:
  
  * docx: `application/vnd.openxmlformats-officedocument.wordprocessingml.document`
  * odt: `application/vnd.oasis.opendocument.text`
  
  If you're getting a different value, hopefully it will provide a helpful clue as to the problem. If not, please edit the question again to show the error you're getting.
  
  > **Comments:**
  > **username_3**: I just successfully uploaded your document as a message template.  So I would definitely check for MIME type issues with your webserver!  
  > **username_4**: Thanks @Jon G, I'm still having trouble with templates. I've edited MessageTemplates.php as per your suggestions above and I'm still getting an error.  "MIME type: application/octet-stream" My mime types are set up exactly as you describe above. Any suggestions?  
  
  ---
  
  ### Answer by username_3 on 2019-01-28. Score: 1
  
  Based on your comment on my other answer, the issue is that your web browser is setting the MIME type incorrectly to `application/octet-stream`, which basically means "unknown file type". While detailed answers exist on [how browsers determine MIME type](https://stackoverflow.com/questions/1201945/how-is-mime-type-of-an-uploaded-file-determined-by-browser), the short answer is to see if you can isolate the problem to a particular operating system, browser, etc.
  
  As a fallback, you can simply delete the line I suggested you modify in my other answer - it's very likely this will cause things to start working. However, this isn't a great long-term answer, if for no other reason than you'll need to apply the fix every time you upgrade.
  
  > **Comments:**
  > **username_4**: Thanks @Jon G, I can confirm that the same problem occurs on both Windows and ChromeOS using the Chrome browser. I'll have to load up another browser to see if it is browser based.  
  > **username_4**: Tried Firefox, same result. I'll try deleting that line.  
  > **username_4**: OK, was able to "upload" using FF under Linux. No joy though, the contents of the file were not added to the template.  
  > **username_4**: OK, so I had to update the registry entry for docx to add Content Type = application/vnd.openxmlformats-officedocument.wordprocessingml.document and now it works.  
  
  ---
  
  