Uploading .docx (word) documents with php

software development


I am trying to upload docx files using a basic php upload form.

i have added the proper mime types to my validation

$types = array(‘application/pdf’,‘application/msword’,‘text/plain’,‘application/vnd.openxmlformats-officedocument.wordprocessingml.document’,‘application/wordperfect6.0’);

and I added the following to my .htaccess file

AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx

My validation keeps failing.

Has anyone gotten this to work?


Missing a dot maybe?

AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document [color=#CC0000].docx[/color]

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


keep in mind that the browser decides what mime type to send, and sometimes different browsers make different decisions. for example, internet explorer sends image/pjpeg for jpeg images while everybody else sends image/jpeg. so if you’re checking what mime type the browser says the file is, test in all the browsers you care about to make sure it uses a mime type you’re handling.

track7 - my dream-hosted site