Skip to content
Advertisement

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.

Advertisement

Answer

You can add

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

in application/config/mimes.php

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement