Hello, I’m having trouble getting pdf, doc and docx files to upload.
I have a page blueprint like this, it’s only the downloads part :-
downloads:
type: structure
label: Documents
fields:
title:
label: Year
type: date
display: YYYY
downloadFile:
label: Documents
type: files
min: 1
template: docs
and then a files/docs.yml like this:-
title: Docs
accept: application/pdf, doc, docx
but I’m getting an error:-
Could someone please point me in the right direction, many thanks.
If the mime type doesn’t work, I’d try with the extension, instead.
Okay , I have changed my docs.yml to:-
title: Docs
accept:
extension: pdf, doc, docx
Cleared the cache, logged out and logged in again and I still see the same issue.
But with the above I can upload images.
Just for clarity I am on version 3.6.6
Hm, I think you need to make sure that your server is correctly configured for the different mime types.
If you are on Apache, you can do this in your .htaccess within the mod_mime module
Apologises, this is just a local build at the moment.
I am running a public file structure with the .htaccess in the public folder.
I have added this to my .htaccess, is this what you meant, I’m not to sure?
# add file types
<IfModule mod_mime.c>
AddType application/pdf .pdf
AddType application/msword .doc
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx
</IfModule>
If this is correct I’m still seeing the same issue.
For those of you who get stuck in the same way, I solved this when I realised I had a default.yml in my blueprints/files folder, this appeared to override all other blueprints.
Once removed everthing worked as expected.
Hm, interesting, I’d consider this a bug if I can reproduce this.