Forum

Thread tagged as: Problem, Configuration, Forms

.pdf uploads work but .doc uploads don't?

This might be a quick one.

I've setup a form to allow the user to upload either a .pdf or a .doc file only. I've using the default filetypes.ini file, not made any changes to that.

Here's the template code I'm using:

<perch:input type="file" id="cv" label="CV" accept="pdf doc" class="required" required="true" />

The form accepts a .pdf upload, but not a .doc upload.

Any ideas why?

Stephen Meehan

Stephen Meehan 4 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are pdf and doc defined as groups in your filetypes.ini file?

Hi Drew

I'm using the default filetypes.ini supplied with Perch.

PDF is in the filetypes.ini file

[pdf] 
application/pdf

How do I add a .doc file? Would it just be:

[doc] 
application/doc
Drew McLellan

Drew McLellan 2638 points
Perch Support

Might be application/msword but it would depend on the file.

Hmmm...

application/msword is in the default filetypes.ini file

[office] 
...
application/msword
...

The file is just a Microsoft word .doc

Anything else I could try?

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's in the group office though, and you're not using that group in your tag.

Ah, so when I write

accept="pdf doc"

within perch:input, pdf and doc are groups.

[doc] 
application/msword

A list of accepted file types must be added to a group - is that right?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, great. Are you sure this file identifies as application/msword ?

Not sure, how would I find out how a file identifies itself?

I'll have time after lunch today to add this to the filetypes.ini file. Hope it works... :)

[doc] 
application/msword

Hi Drew

That worked a treat.

Thanks again!