Problem In Uploading Word File

Hi All,

I am trying to upload a word (.docx) file using CUploadFile, and the file successfully uploaded.

But the problem I am facing is, that the file .docx upload as zip file.

Do anybody have any idea about the same,as I couldn’t find such problem in the forum and stackoverflow.


A .docx file is a zip file (with a different extension). Are you saying that uploading it changed the extension?

Thanks Keith,

For your quick reply :)

I am actually rename the file with a number, to make all files unique.

Say if I upload foo.docx, then the file save in the destination folder with the name say 8822(This can be any random number)

Is the file name after saving: ‘8822’, ‘8822.docx’, ‘’, or something else?

So what do you mean it is saved as a zip file?


THe file name is 8822 only (say it is a primary key of any database table).

But when I see into the destination folder, and double click on the file which I have uploaded, it open as compress file folder. so that I am saying it save as zip file.

As Keith said, docx files are compressed/zip files. You should pull the uploaded file extension and include it in the saved filename. Your OS may be reading some magic numbers in the file that is telling the system the file is a zip file. With the ext, the system would use file associations first.