Welcome Guest, Not a member yet? Register   Sign In
Codeigniter Upload Video
#1

[eluser]Unknown[/eluser]
I tried to upload the video but did not get into the server continues, I wonder why huh?

my mime config
Code:
'wmv' => array('video/wmv', 'video/x-ms-wmv', 'flv-application/octet-stream', 'application/octet-stream'),
'flv' => array('video/x-flv', 'flv-application/octet-stream', 'application/octet-stream'),
'mp4' => 'video/mp4',
'3gp' => 'video/3gpp'

my view
Code:
<div id="upload">
            &lt;?php
            echo form_open_multipart('audio');
            echo form_upload('userfile');
            echo form_submit('upload','Upload');
            echo form_close();
            ?&gt;
</div>

my controller
Code:
function index() {
        $this->load->model('Audio_model');
        if ($this->input->post('upload')) {
            $this->Audio_model->do_upload();
        }
        $this->load->view('v_audio');
    }

and my model
Code:
function do_upload() {
        $config = array(
            'allowed_types' =>  'mp4|3gp|flv|mp3',
            'max_size'=>'100000',
            'upload_path' => $this->gallery_path
        );
        $this->load->library('upload', $config);
        if ($this->upload->do_upload()) {
            echo "Upload success!";
        } else {
            echo "Upload failed!";
        }
    }

If I upload an mp3 file successfully, but if mp4, 3gp, flv is failed to upload.
friends help me please Smile



#2

[eluser]Sudz[/eluser]
Add mime type in the config/mimes.php

Code:
'flv'    => array('video/x-flv', 'flv-application/octet-stream', 'application/octet-stream'),
'mp4' => 'video/mp4',
'3gp' => 'video/3gpp'




Theme © iAndrew 2016 - Forum software by © MyBB