I am using the following code to upload a video.
<?php
class upload_videos extends Admin_Controller {
function __construct() {
parent::__construct();
$this->load->helper('form');
}
function index () {
$this->load->view('admin/upload_form', array('error'=> ''));
}
function do_upload() {
$config['upload_path'] = './uploads';
$config['allowed_types'] = 'mov|mpeg|mp3|avi';
$config['max_size']= '';
$config['overwrite'] = FALSE;
$config['remove_spaces'] = TRUE;
$config['encrypt_name'] = TRUE;
$this->load->library('upload', $config);
if(!$this->upload->do_upload()) {
$error = array('error'=>$this->upload->display_errors() . ' hi');
$this->load->view('admin/upload_form', $error);
} else {
echo 'asasas';
$data = array('upload_data'=>$this->upload->data());
$this->load->view('admin/upload_success', $data);
}
}
}
My problem is when I try to download the mp4 video that it shows me
line (9) "video / mp4"
message. it doesn’t get elsewhere and the video does not load. Can someone please help me do this.
Note. I set the maximum file sizes in php.ini and notice that I tried to set the mime type as $this->_file_mime_type($_FILES[$field]); var_dump($this->file_type); die();as well
Edited
I modified the above code to upload images, it gave me the same result. It seems like nothing could be loaded using my code.
source
share