Search code examples
phpcodeigniter-3

codeingitor how to allow .bmp file to upload?


I want to allow .bmp file format to upload

Here is my code:

            $config = [];
            $config['file_name'] = $filename;
            $config['upload_path'] = $dir;
            $config['allowed_types'] = 'jpg|jpeg|png|gif|bmp|pdf';
            $config['max_size'] = '10000';

            $this->upload->initialize($config);               
            $fileData = $this->upload->data();

but error like The filetype you are attempting to upload is not allowed.


Solution

  • You can add

    $mimes = array('bmp' => array('image/bmp', 'image/x-windows-bmp', 'image/x-ms-bmp'))
    

    in application/config/mimes.php