I had a client email me with an interesting dilemma a couple days ago.  He was working with a document library and uploading .docx files.  He was creating a group of Office 2007 files and Office 2003 files and uploading multiple files at once.  He emailed me saying that all the files were uploading but .docx files.  Sure enough, they weren’t uploading and no errors were being generated.

He emailed me a screenshot of the upload, and I noticed something strange.  The size of the Word document was 0 K.  I created my own blank Word document, saved it and uploaded it and it was 10 K.  Curious about the difference, I thought he had a corrupted or bad Word file.  Nope, it open just fine in Word, but was still 0 K.

Come to find out, he was right clicking on his desktop and selecting New Microsoft Word Document  I was going into Word and saving the open file.  The file created by right clicking on the desktop, is a valid Word file, but is missing some key info that was causing the upload to fail.

If you open a .docx file in WinRAR or WinZip, you’ll notice it is actually a collection of folders and XML files.  When saving a blank Word file from within Office, there are some default XML files that are created and added, however, when you create the file by right clicking your desktop, none of those XML files are created.  If you try to open such a file in WinRAR you get an invalid archive error as opposed to the folder and file structure you usually see within a .docx file.

The lesson, if you’re going to do testing with a blank Word document, create it from within Word and not by right clicking on your desktop.