CodeIgniter Forums
Problem with Video Uploading - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem with Video Uploading (/showthread.php?tid=52268)



Problem with Video Uploading - El Forum - 06-04-2012

[eluser]soijiro[/eluser]
Hi guys,
i got problem when i try to upload videos file (in other case it works such jpg, png, mp3).

here's my controller
Code:
$this->img_config['upload_path'] = $this->dir;
            $this->img_config['max_size'] = '20000000';
            $this->img_config['overwrite'] = TRUE;
            $this->img_config['allowed_types'] = 'mpeg|mp3|flv';
            $this->upload->initialize($this->img_config); //initiate the upload library

            if(is_array($_FILES) && !empty($_FILES))
            {
                if ( ! $this->upload->do_upload()) {
                    echo $this->upload->display_errors();
                }
                else {
                    $data = array('upload_data' => $this->upload->data());
                    $image_data = $this->upload->data();
                }
            }else{
                ;
            }
            echo var_dump($this->upload->data());
            // For Debugging
            echo "<br/>Mime uploaded: ".$this->upload->file_type."<br>";
            foreach ($this->upload->allowed_types as $val)
            {
                echo "allowed: "; var_dump($this->upload->mimes_types(strtolower($val))); echo "<br>";
            }

i try to debug when uploading video file (.mpeg).
Code:
array(14) { ["file_name"]=> string(0) "" ["file_type"]=> string(0) "" ["file_path"]=> string(7) "./data/" ["full_path"]=> string(7) "./data/" ["raw_name"]=> string(0) "" ["orig_name"]=> string(0) "" ["client_name"]=> string(0) "" ["file_ext"]=> string(0) "" ["file_size"]=> string(0) "" ["is_image"]=> bool(false) ["image_width"]=> string(0) "" ["image_height"]=> string(0) "" ["image_type"]=> string(0) "" ["image_size_str"]=> string(0) "" } Mime uploaded:
allowed: string(10) "video/mpeg"
allowed: array(4) { [0]=> string(10) "audio/mpeg" [1]=> string(9) "audio/mpg" [2]=> string(11) "audio/mpeg3" [3]=> string(9) "audio/mp3" }
allowed: array(2) { [0]=> string(11) "video/x-flv" [1]=> string(24) "application/octet-stream" }

but when i try to upload mp3 file it is work perfectly
Code:
array(14) { ["file_name"]=> string(32) "Adele+-+Set+Fire+To+The+Rain.mp3" ["file_type"]=> string(9) "audio/mp3" ["file_path"]=> string(32) "C:/xampp/htdocs/project/eo/data/" ["full_path"]=> string(64) "C:/xampp/htdocs/project/eo/data/Adele+-+Set+Fire+To+The+Rain.mp3" ["raw_name"]=> string(28) "Adele+-+Set+Fire+To+The+Rain" ["orig_name"]=> string(32) "Adele+-+Set+Fire+To+The+Rain.mp3" ["client_name"]=> string(32) "Adele+-+Set+Fire+To+The+Rain.mp3" ["file_ext"]=> string(4) ".mp3" ["file_size"]=> float(5819.98) ["is_image"]=> bool(false) ["image_width"]=> string(0) "" ["image_height"]=> string(0) "" ["image_type"]=> string(0) "" ["image_size_str"]=> string(0) "" } Mime uploaded: audio/mp3
allowed: string(10) "video/mpeg"
allowed: array(4) { [0]=> string(10) "audio/mpeg" [1]=> string(9) "audio/mpg" [2]=> string(11) "audio/mpeg3" [3]=> string(9) "audio/mp3" }
allowed: array(2) { [0]=> string(11) "video/x-flv" [1]=> string(24) "application/octet-stream" }

i've checked mime, and i found what the mime for the ext what i set allowed.
so, it is supposed to be work, i think.

the problem when i upload .flv, .mpeg file, it show empty.

Regards,
Soijiro



Problem with Video Uploading - El Forum - 06-04-2012

[eluser]Learn CodeIgniter[/eluser]
If you are on a live server make sure that your hosting provider has those mime types installed, I had to go into my control panel to install the flv mime type.

Add to .htaccess
Code:
AddType video/mpeg .mpeg .mpg .mpe
AddType video/x-flv .flv



Problem with Video Uploading - El Forum - 06-04-2012

[eluser]soijiro[/eluser]
Thanks for reply man.
I'm working on localhost now.

i'm trying to check mime installed on C:\xampp\apache\conf\mime.types.
but it still not work.


Problem with Video Uploading - El Forum - 06-04-2012

[eluser]Learn CodeIgniter[/eluser]
If you are running ci ver 2.1.0 I think there was a problem with mime types. Try the development ver on github.

CodeIgniter on GitHub



Problem with Video Uploading - El Forum - 06-04-2012

[eluser]soijiro[/eluser]
Yes i'm running CI Ver. 2.1.0
i have replace my system/libraries/upload.php also with the update.
error on line 1058.
but still not work.

edited
I'll try to replace, with development version.

still not work. Sad