CodeIgniter Forums
Upload woks but not for .ogg files - 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: Upload woks but not for .ogg files (/showthread.php?tid=55880)



Upload woks but not for .ogg files - El Forum - 11-14-2012

[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?


Upload woks but not for .ogg files - El Forum - 11-14-2012

[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.


Upload woks but not for .ogg files - El Forum - 11-14-2012

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


Upload woks but not for .ogg files - El Forum - 11-15-2012

[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.


Upload woks but not for .ogg files - El Forum - 11-15-2012

[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'),



Upload woks but not for .ogg files - El Forum - 11-15-2012

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


Upload woks but not for .ogg files - El Forum - 11-15-2012

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