CodeIgniter Forums
upload images file with rename extension - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: upload images file with rename extension (/showthread.php?tid=65401)



upload images file with rename extension - rchiu5hk - 06-08-2016

Dear all,

I am using below code. Then I have images file renamed from gif to bmp or jpg in extension. When I using below code to upload this image file, it will have issues as there is error. If I have not renamed the file extension, it is OK to upload images with correct extension.
I just think that if I rename files from image file extension to another image file extension can be OK. But if I rename bat or csv to images file extension, it is not OK and should not allow if I have configured the correct allowed file type. (not allow bat, csv.....).
Is it possible????

Code:
$config['file_name'] = basename($imgPath);
                $config['upload_path'] = $upload_dir;  
                $config['allowed_types'] = 'gif|jpg|png|bmp|jpeg';    // '*';
                
                $this->upload->initialize($config);
                if ( ! $this->upload->do_upload('image'))
                {
                    if($this->upload->display_errors()<>'')
                    {



RE: upload images file with rename extension - InsiteFX - 06-09-2016

You cannot change the file extension to a different format they are not compatible.