Welcome Guest, Not a member yet? Register   Sign In
Image not uploading!
#1
Rainbow 

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.
Reply


Messages In This Thread
Image not uploading! - by dreamweaver - 07-15-2019, 05:49 AM
RE: Image not uploading! - by mboufos - 07-15-2019, 06:08 AM
RE: Image not uploading! - by Wouter60 - 07-15-2019, 06:15 AM
RE: Image not uploading! - by dreamweaver - 07-16-2019, 04:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB