Forum

Thread tagged as: Question, Error, Forms

docx file upload

Hi, I need upload a file .docx from App Form, but I have an error when sending form "That type of file is simply unacceptable" My ini file include this type file:

[docx] 
application/docx

[docx] 
application/msword

My template is:

<perch:label for="file">Please upload your abstract here (PDF or DOC)</perch:label>
<perch:input type="file" id="file" accept="pdf doc docx" />
<perch:error for="file" type="filetype">That type of file is simply unacceptable.</perch:error> 
<perch:error for="file" type="fileupload">An error did occur while uploading yonder file.</perch:error>

Thanks.

alex s

alex s 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I Googled for "docx mime type" which led me to this:

https://stackoverflow.com/questions/4212861/what-is-a-correct-mime-type-for-docx-pptx-etc

which suggests the correct mime type is this:

application/vnd.openxmlformats-officedocument.wordprocessingml.document
alex s

alex s 0 points

Does not work!

[docx] application/vnd.openxmlformats-officedocument.wordprocessingml.document

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do other formats?

alex s

alex s 0 points

Yes:

accept="pdf doc docx office"
Drew McLellan

Drew McLellan 2638 points
Perch Support

And that works with a regular Word doc, for example?

alex s

alex s 0 points

Yes, only .doc files.

Drew McLellan

Drew McLellan 2638 points
Perch Support

In which case, I'm not too sure. Mime type detection is down to your server (it doesn't happen in Perch itself) and it sounds like it's generally working. Clearly not for that document type, however.

alex s

alex s 0 points

Thanks Drew, regards.