rka05
(Raghav Agarwal 05)
April 22, 2014, 1:41pm
1
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.
Thanks!
Keith
(Kburton)
April 22, 2014, 1:53pm
2
A .docx file is a zip file (with a different extension). Are you saying that uploading it changed the extension?
rka05
(Raghav Agarwal 05)
April 22, 2014, 5:07pm
3
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)
jkofsky
(Jkofsky)
April 23, 2014, 12:45am
4
rka05:
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’, ‘8822.zip’, or something else?
So what do you mean it is saved as a zip file?
rka05
(Raghav Agarwal 05)
April 23, 2014, 2:00am
5
jkofsky:
Is the file name after saving: ‘8822’, ‘8822.docx’, ‘8822.zip’, or something else?
So what do you mean it is saved as a zip file?
Hi,
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.
jkofsky
(Jkofsky)
April 23, 2014, 2:27am
6
rka05:
Hi,
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.