CodeIgniter Forums

Full Version: Upload woks but not for .ogg files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]A_funs[/eluser]
I have a working upload script for mp3 files, the config code is below, it works fine with mp3's but with ogg files it gives the error of
"the filetype you are attempting to upload is not allowed"


Code:
$config['upload_path'] = 'songs/';
       $config['allowed_types'] = 'mp3|ogg';
       $config['max_size'] = '10000';

Any ides why this is happening?

El Forum

[eluser]adamck[/eluser]
In your Config folder, open mimes.php

then add
Code:
'ogg' => 'audio/ogg',

Somewhere around the mpg mime type.

Should work then Smile

The 'allowed types', only allows you to suggest things defined in the mimes.php config file.

El Forum

[eluser]Aken[/eluser]
Also check to see what kind of mime type the file actually carries, since sometimes the browser alters these.

El Forum

[eluser]Narf[/eluser]
[quote author="Aken" date="1352950676"]Also check to see what kind of mime type the file actually carries, since sometimes the browser alters these.[/quote]

What the browsers says will be ignored, there's a server-side detection of the MIME type.

El Forum

[eluser]A_funs[/eluser]
I added the code to the mimes.php file like below, however it is still giving me the same error...

Code:
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'ogg' => 'audio/ogg',
'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'),

El Forum

[eluser]A_funs[/eluser]
Also I checked the mime type through the browser headers and it is coming through as audio/ogg

El Forum

[eluser]Narf[/eluser]
Try this: http://ellislab.com/forums/viewreply/1040236/