CodeIgniter Forums
Upload .php file help - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Upload .php file help (/showthread.php?tid=3687)



Upload .php file help - El Forum - 10-17-2007

[eluser]Justin Patel[/eluser]
Hello Friends,


Code:
$config['upload_path'] = './language/';
        $config['allowed_types'] = 'gif|jpg|png|php';
        $config['max_size']    = '15500';
        $config['max_width']  = '1024';
        $config['max_height']  = '768';                    
        $this->load->library('upload', $config);
        $upload =  $this->upload->do_upload();


When I try to upload .php file. It gives error like


Code:
Array ( [error] =>

The filetype you are attempting to upload is not allowed
)


But it works for the .gif images

Please Help me out




Best Regards Smile


Upload .php file help - El Forum - 10-17-2007

[eluser]xwero[/eluser]
You have to use native upload variables to find out what mime type the browser adds to upload your file
Code:
echo $_FILES['userfile']['type']
And add the mime type to the mimes.php file in the config directory for the php key.