CodeIgniter: File does not upload if it finds some specific words in the file
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'txt';
$config['max_size'] = '10000';
$this->load->library('upload', $config);
if(!$this->upload->do_upload('datafile')){
print_r($this->upload->display_errors());
}else{
// rest of work
}
Everything is ok but when it try to upload a text file containing char starting new line ( example: charlie@mail.com ), it shows this error: The filetype you are attempting to upload is not allowed.
Same thing happen with image file too by adding ‘char’ word inside of image file. Note: I have found only ‘char’ word, but i strongly believe there are some more words which also conflict.
But with
var_dump($_FILES);
it shows that it is correct mime type file.
when it gets global file type setting:
$config[‘allowed_types’] = ‘*’;
It works.
Codeigniter version 3.1.5
Note2: The problem dose not occur in older version like 2+, but only with version of 3+
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (12 by maintainers)
What do you mean why? A type check was declared a type check is being done - that’s why.