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
$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.
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.
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'].
I think its a bug on v 2.1.0. Try these instructions to fix the issue http://ellislab.com/forums/viewthread/204725/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With