Can't upload file. $this->upload->do_upload('anonsphoto'); returns false. Can't find out why.
I added upload library to autoload this way: $autoload['libraries'] = array('upload');
Here is my view:
<?php
echo form_open_multipart('InterviewController/saveInterview');
$anons_data = array(
'name' => 'anons',
'id' => 'anons_area',
'value' => 'Введите анонс'
);
echo form_textarea($anons_data); ?>
<p>Картинка анонса</p>
<?php
echo form_upload('anonsphoto'); ?>
Here is controller which uploads file:
public function saveInterview() {
$config['upload_path'] = '/application/upload/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '10000';
$config['file_name'] = 'img_' . (string) time();
$this->upload->initialize($config);
$this->upload->do_upload('anonsphoto');
return;
}
Uploading file is 3 kb sized png file. I can't understand why do_upload is returning false. Any ideas?
echo $this->upload->display_errors();.