Welcome Guest, Not a member yet? Register   Sign In
The filetype you are attempting to upload is not allowed
#1

[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";
}




Theme © iAndrew 2016 - Forum software by © MyBB