Downloading video from Codeigniter does not work

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.

+4
source share
3 answers

. .

PHP ini

post_max_size = 100M
upload_max_filesize = 100M

(100M)

LimitRequestBody 1073741824

, PHP 30 script, script 30 .

, , script , , ..,

set_time_limit(600);  // 10 minutos execution

+1

mp4 allowed_types, :

$config['allowed_types'] = 'mov|mpeg|mp3|avi|mp4';

mime- mp4 config/mimes.php, , :

'mp4' => array('video/mp4', 'application/octet-stream')
0
0
source

All Articles