I’m creating an upload form using CodeIgniter and I’d like to upload a plaintext file with a .out extension. In my controller I’ve set the following options:
// Set upload variables
$uploadConfig['upload_path'] = 'uploads/temp/';
$uploadConfig['allowed_types'] = 'out|txt';
$uploadConfig['max_size'] = '1024';
$this->load->library('upload', $uploadConfig);
In the mimes.php config file, I have the following:
'text' => 'text/plain',
'out' => 'text/plain',
And in my httpd.conf file on my server, I’ve added the line:
AddType text/plain .out
Whenver I try to upload a .out file, I get the error message The filetype you are attempting to upload is not allowed. An identical file with a .txt extension uploads just fine.
Any thoughts on how to get this custom mime type to work with CI? Thanks!
That looks like it should work. The Upload class just explodes the ‘allowed_types’ string at the pipe separator, then checks if the file extension is in the array.
Does it work if you use ‘*’ as the allowed_types config setting?