Mime Type errors for upload library |
I'm getting an error stating that the "type is not allowed", but I've tried both the file extension and the mime types separated by pipes.
I'm attempting to allow uploads of .odt, .ods, .odp, .docx, .xls, txt, zip, and .pdf files. Code: $config['allowed_types'] = 'application/vnd.oasis.opendocument.spreadsheet | application/vnd.oasis.opendocument.text | application/vnd.oasis.opendocument.presentation | application/vnd.openxmlformats-officedocument.wordprocessingml.document | application/vnd.ms-excel | application/vnd.openxmlformats-officedocument.presentationml.presentation | zip | txt | application/pdf'; Here is where I got the MIME types for the LibreOffice files. Any ideas?
Did you try not using spaces between the pipe separated types? (type1|type2|type3) vs (type1 | type2 | type3)
Not happy with the solution, but I used.
$config['allowed_types'] = '*'; to allow all
For troubleshooting, I'd try a single mimetype at a time. Upload a file with that mimetype and if it works, add the next one separated by a pipe and retry the upload with that new filetype. Keep going until it breaks.
I've never tried to put mimetypes directly in the $config['allowed_types'] and have always used a piped delimeter of extensions (pdf|jpg|gif), with the corresponding mimetypes in the /config/mimes.php config file. According to the docs, you should be able to use the mimetypes directly in the $config['allowed_types'], but I've never tried. |
Welcome Guest, Not a member yet? Register Sign In |