Using the Form plugin, I’m having troubles with uploading files other than images.
When I modify a form page frontmatter using a text editor or the Admin panel like so:
name: file_upload label: 'Add a file' type: file multiple: false destination: 'user/data/files' accept: [application/pdf, application/x-pdf, image/png, text/plain]
Grav reformats the list of MIME types like this:
name: file_upload label: 'Add a file' type: file multiple: false destination: 'user/data/files' accept: - application/pdf - application/x-pdf - image/png - text/plain
This setting allows me to select only PDF files, PNG format images and text files. So far, so good.
However when I select a text file and submit the form, Grav complains: ‘File “sample.txt” is not an accepted MIME type.’
Examining the POST request with the Firefox Addon HttpFox I can see the MIME type is ‘Content-Type: text/plain’. Still the file is rejected. The same goes for PDF files but PNG files are allowed and saved in the page folder (BTW not in ‘user/data/files’ which exists and is writable).
I’ve tested the upload both on localhost (OSX, PHP Version 5.6.16) and on a shared host (Linux, PHP Version 5.6.15).
Any help is much appreciated.