I’m trying to upload a css file user codigniter’s upload class. Here is the controller:
public function uploadcssfile()
{
$config['upload_path'] = './stylesheets/stores/'.$memberid.'/';
$config['file_name'] = 'main.css';
$config['allowed_types'] = 'css';
$config['overwrite'] = true;
$this->load->library('upload', $config);
if (! $this->upload->do_upload('filefieldname'))
{
die($this->upload->display_errors());
}
}
I just want to upload a file of type css, yet codeigniter always gives this error:
The filetype you are attempting to upload is not allowed.
I know, this is really weird but it worked for me:
in application/config/mimes.php, line 77
change to:
To see, if your development environment has its own sense of humour and can add new mime types to any text files (my case), check your mimes like this:
If an upload fails it will show you what mime type your server is actually getting to deal with.
PS. Now that there is an answer to your question, go here and help me 🙂