CodeIgniter Forums
The filetype you are attempting to upload is not allowed - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: The filetype you are attempting to upload is not allowed (/thread-10721.html)



The filetype you are attempting to upload is not allowed - El Forum - 08-10-2008

[eluser]PHP Programmer[/eluser]
Hi

I am getting an error while running file upload function. I am uploading the file format same as defined under 'allowed_types'/'mimetypes' ie gif,png,jpg.

Also, if I run it independently then it works fine but when I embed it in my code then the following error occurs.

The error says:

Array ( [error] =>

The filetype you are attempting to upload is not allowed
)

My Code is: (Under 'controller' directory)

$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';

$this->load->library('upload', $config);

if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());

print_r($error);
}
else
{
$data = array('upload_data' => $this->upload->data());

echo "success";
}