Can’t upload a Word document? You need to close it first.

If you are a savvy web developer, you almost certainly won’t allow users to upload any old file to your site in case it’s a virus or other malware. You’ll probably use MIME types to restrict which files people can upload.

The trouble is the for some reason, when you have a Word document open, it reports a different MIME type than when it is closed, which will scupper your upload routine.  Since the type reported makes it look like an executable file (and therefore potentially dangerous) your code probably won’t allow it, and rightly so.

The solution, therefore, is for your user to close the document before they try to upload it.

I’m not sure whether this is specific to Windows/IE (I wouldn’t be surprised) but if you have trouble uploading Word docs, this could provide to solution.  (When I have time I’ll test how other document types behave…)

Monday, May 10th, 2010 Uncategorised

No comments yet.

Leave a comment

Bookmark and Share