PHP Code:
<div class="custom-file">
<input name="image" type="file" class="custom-file-input" id="customFile">
<label class="custom-file-label" for="customFile">Choose Image</label>
</div>
PHP Code:
public function create_blog()
{
if (!isset($_POST['submit']))
{
$this->load->view('temp/header-short');
$this->load->view('admin/create_blog');
$this->load->view('temp/footer');
}
else {
$image = $_POST['image'];
$head = $_POST['head'];
$body = $_POST['body'];
$footer = $_POST['footer'];
$config['upload_path'] = './src/img/blog';
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 10000;
$config['max_width'] = 4000;
$config['max_height'] = 4000;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('image'))
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('temp/header-short');
$this->load->view('admin/create_blog', $error);
$this->load->view('temp/footer');
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
}
Error message is 'You did not upload the file'.
I cannot see anything wrong.