Codeigniter video upload is not working in live server

428 Views Asked by At

I am using following code to upload video in my codeigniter project.

This is my view code

<?php echo $error;?>
<?php echo form_open_multipart('upload/do_upload');?>
    <input type="file" name="userfile" size="20" />
    <input type="submit" value="upload" />
</form>

This is controller

class Upload extends CI_Controller {
    public function __construct()
    {
        parent::__construct();
        $this->load->helper(array('form', 'url'));
    }
    public function do_upload()
    {
        $config['upload_path']          = './uploads/';
        $config['allowed_types']        = 'gif|jpg|png|mp4';
        $config['max_size']             = 100000;
        $config['max_width']            = 1024;
        $config['max_height']           = 768;
    
        $this->load->library('upload', $config);
    
        if ( ! $this->upload->do_upload('userfile'))
        {
            $error = array('error' => $this->upload->display_errors());
            var_dump($error);
        }
        else
            $data = array('upload_data' => $this->upload->data());
    }
}

This code working fine through xampp. But I'm facing error in live server/cpanl. When I try to upload video every time it shows following error,

array(1) { 
    ["error"]=> string(43) 
    "You did not select a file to upload." }
1

There are 1 best solutions below

1
On

Looks like uploads or functions might be disabled inside php.ini trying running your code with error_reporting(E_ALL); to see if some error occured except for You did not select a file to upload. error