EllisLab text mark
Advanced Search
     
Upload woks but not for .ogg files
Posted: 14 November 2012 04:21 PM   [ Ignore ]
Joined: 2012-01-13
21 posts

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”

$config['upload_path''songs/';
       
$config['allowed_types''mp3|ogg';
       
$config['max_size''10000'

Any ides why this is happening?

 
Posted: 14 November 2012 06:46 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2012-07-27
27 posts

In your Config folder, open mimes.php

then add

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

 
Posted: 14 November 2012 11:37 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-28
2435 posts

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

 
Posted: 15 November 2012 06:51 AM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2012-01-09
117 posts
Aken - 14 November 2012 11:37 PM

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

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

 
Posted: 15 November 2012 10:26 AM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Joined: 2012-01-13
21 posts

I added the code to the mimes.php file like below, however it is still giving me the same error…

'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'ogg' => 'audio/ogg'
'mp3' => array('audio/mpeg''audio/mpg''audio/mpeg3''audio/mp3'), 
 
Posted: 15 November 2012 12:43 PM   [ Ignore ]   [ # 5 ]   [ Rating: 0 ]
Joined: 2012-01-13
21 posts

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

 
Posted: 15 November 2012 04:36 PM   [ Ignore ]   [ # 6 ]   [ Rating: 0 ]
Avatar
Joined: 2012-01-09
117 posts

Try this: http://ellislab.com/forums/viewreply/1040236/