Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange Issue with Video File Upload in CodeIgniter

I am building a video site on CodeIgniter (v 2.1.0). The admins can upload videos via admin panel. It works perfectly on my local server. But on remote test server, it's not working. I have set the mimes.php to recognize the file-type correctly. The allowed file-types are okay. But the error message says the file-type isn't permitted. Here's my mimes.php:

...
'mp4'  => 'video/mp4',
'flv'  => 'video/x-flv',
'avi' => 'video/x-msvideo',
'mpeg' => 'video/mpeg',
...

Alowed file-types:

$upload_config['allowed_types'] = 'flv|mp4|avi|mpeg'

Upload library is initialised with $this->upload->initialize($upload_config); If I do a var_dump for $_FILES it gives me:

array(1) { ["video_file"]=> array(5) { ["name"]=> string(48) "test_video_file.mp4" ["type"]=> string(9) "video/mp4" ["tmp_name"]=> string(14) "/tmp/phpwkOICI" ["error"]=> int(0) ["size"]=> int(5668643) } } 

What is wrong with it? What drives me nuts is that the same script works fine on my local machine but doesn't work on remote test sub-domain. And every debug message looks legit to me. Any help is much appreciated. Thanks and regards

like image 954
abhisek Avatar asked Apr 03 '12 15:04

abhisek


People also ask

How can check max file upload size in CodeIgniter?

$config['max_size'] = 2000; set the maximum file size in kilobytes. In our example, the maximum file that can be uploaded is 2,000kb close to 2MB. If the user tries to upload a file larger than 2,000kb, then the image will fail to upload and the library will return an error message.

Which method is used to upload file in CodeIgniter?

File uploading in CodeIgniter has two primary parts—the frontend and the backend. The frontend is taken care of by the HTML form that uses the form input type file. On the backend, the file upload library forms the submitted input from the form and writes it to the transfer registry.

How can upload file path in CodeIgniter?

It depends upon how you are storing the uploaded data. If you are simply storing like: $data = $this->upload->data(); then access it by $data['full_path']; else if you are storing like $data = array('upload_data' => $this->upload->data()); then access it by $data['upload_data']['full_path'].


1 Answers

I think its a bug on v 2.1.0. Try these instructions to fix the issue http://ellislab.com/forums/viewthread/204725/

like image 171
safarov Avatar answered Nov 07 '22 07:11

safarov