CodeIgniter Forums

Full Version: uploading video problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]andieevans[/eluser]
Hi

Fairly new to codeigniter, have used upload to upload images with no problems, howerver video is not working...

here is some code I am using:

Code:
$configVideo['upload_path'] = 'video/';
$configVideo['max_size'] = '13333330240';
$configVideo['allowed_types'] = 'avi|flv|wmv|mpg';
$configVideo['overwrite'] = FALSE;
$configVideo['remove_spaces'] = TRUE;
$this->load->library('upload', $configVideo);
$this->upload->initialize($configVideo);

if (!$this->upload->do_upload('userfile')) {
echo $this->upload->display_errors();
} else {
$file = $this->upload->data();
echo "Successfully Uploaded";
}

I am trying to upload a simple mpg video, and keep getting the following message:

"The filetype you are attempting to upload is not allowed."

this is annoying as it is a filetype that I am allowing!

any help will be mucho appreciated!

El Forum

[eluser]solid9[/eluser]
What is the filetype of your video?

mpg or mpeg?


we need more details.

El Forum

[eluser]vitoco[/eluser]
Print the raw $_FILES array to get the mime of the uploaded video and compare it with the one defined in config/mimes.php

Code:
$configVideo['upload_path'] = 'video/';
$configVideo['max_size'] = '13333330240';
$configVideo['allowed_types'] = 'avi|flv|wmv|mpg';
$configVideo['overwrite'] = FALSE;
$configVideo['remove_spaces'] = TRUE;
$this->load->library('upload', $configVideo);
$this->upload->initialize($configVideo);

echo '<pre>'.print_r( $_FILES , true ).'</pre>';

if (!$this->upload->do_upload('userfile')) {
echo $this->upload->display_errors();
} else {
$file = $this->upload->data();
echo "Successfully Uploaded";
}

Saludos

El Forum

[eluser]andieevans[/eluser]
thanks all

I will try outputting the mimetype..

the file extension is .mpg... i have been able to upload a .wmv video with no problems

;o)

El Forum

[eluser]andieevans[/eluser]
ok, here's the output

[name] => delta.mpg
[type] => video/mpeg
[tmp_name] => /tmp/phpGWDJE9
[error] => 0
[size] => 626411

it is type mpeg, as you can see... so I added mpeg to my 'allowed_types' and it still says:

"The filetype you are attempting to upload is not allowed."

El Forum

[eluser]andieevans[/eluser]
I got it licked....

in my mime.php file the declaration for the mpg and mpeg was not quite right, only had video/mpeg, so added the following...

'mpeg' => array('video/mpeg', 'application/octet-stream'),
'mpg' => array('video/mpeg', 'application/octet-stream'),


and it now uploads the file...

;o)

thanks for the help