Is there a way to limit file uploads, via a files section, to only a specific file extension?
I know there is the
accept: mime: etc/etc property in the file blueprints. But, in the docs, I couldn’t find an option to restrict to a specific file extension instead.
Kirby doesn’t know about every existing mime type. For example
.kml files are identified by kirby as
text/html, while it probably would be
application/vnd.google-earth.kml+xml or something like that. Even Chrome/Windows don’t know about that, and they wouldn’t accept it as filter for the “File Open” dialog.
In HTML, you can filter by file extension like this:
<input type="file" accept=".kml">
I can even put
accept: mime: .kml
in the file blueprint and the Windows “File Open” dialog will do its thing. But then Kirby rejects the upload because "
text/html is not allowed" for security reasons (not allowing people to upload php files). But .kml is “almost never” (and certainly not on my server) treated as PHP.
I’d put this on github as feature request, but I’m not sure if I’m just not seeing something in the docs…