Unable to upload docx files from systems which does not have ms office 200
Code : -
<cffile action="upload"
filefield="browsefile"
destination="#variabes.path#"
nameconflict="makeunique"
accept="application/vnd.openxmlformats-officedocument.wordprocessingml .document,
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
Also added mime type "application/vnd.openxmlformats-officedocument.wordprocessingml.docum ent" in IIS
Still getting error.
Please help?
I also would like to see the error message you get, but I'll take a guess as to what the root of the problem is. I suspect that computers without Office 2007 installed do not associate your expected MIME type with the docx file. The accept attribute is constraining what MIME types are valid and the value being submitted is not one of these values. Try removing the accept attribute from the CFFILE tag. Instead of relying on the MIME type provided by the browser to verify you have a docx file check the uploaded file for the expected file extension.
Got the error message
The MIME type of the uploaded file application/octet-stream was not accepted by the server.
<br>Only files of type application/vnd.openxmlformats-officedocument.wordprocessingml.docume nt,
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet can be uploaded. <br>Verify that you are
uploading a file of the appropriate type.
While uploading a docX and XlsX files.
I suspect that the computers uploading these files do not associate the Office 2007 with the expected MIME types.
You have two options:
1. If you have access to the end user's PC you can modify the registry to associate the .docx and .xlsx extensions with the MIME types application/vnd.openxmlformats-officedocument.wordprocessingml.docume nt and application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.
This works for Windows and Internet Explorer. I'm not sure how you would do this on Linux or Mac.
2. Remove the accept attribute from CFFILE. To restrict file types check the extension of uploaded files and delete those that are not permitted.
North America
Europe, Middle East and Africa
Asia Pacific