Hi kirby forum!
My client wants to share a .cer file through their site. When trying to upload the file in the panel I get the following error message: Invalid file type: -
. The point of upload is a page which holds all of the page’s files. On upload it doesn’t assign a template therefore I don’t restrict mime-types. Does anyone have an idea how to prevent this from happening and have the upload succeed?
By default, Kirby only supports a certain set of file types.
You have to define a new file type and then probably use a file blueprint to allow uploading this file type:
Thanks for the reply!
My code for adding a file type now looks like this:
Kirby::plugin('pulsundzeit/FileTypes', [
'fileTypes' => [
'cer' => [
'mime' => ['application/pkix-cert', 'application/octet-stream'],
'type' => 'application',
'resizable' => false,
'viewable' => false
],
]
]);
additionally I’ve created a file blueprint
title: .cer Zertifikat
accept:
mime: application/pkix-cert, application/octet-stream
unfortunately an upload is still not possible in either an unrestricted files section or in a file section with template: cer
.
The reason I added application/octet-stream is that the file seems to actually have the mime type application/octet-stream
for whatever reason. I tried combinations of file blueprint and fileType extension with just pkix-cert or octet-stream or both. None worked so far and either the file is greyed out in the upload dialog or all files are clickable in the dialog and I get the error message Invalid file type: application
on upload.
Am I missing a step needed to activate this file type?