[Vorbis] php and mime type

Michael A. Peters mpeters at mac.com
Wed Dec 16 05:26:06 PST 2009


Hi list,

I'm hoping to find a way via php, preferably without using exec() or 
system(), to reliably identify an ogg vorbis file via php.

Using

$fi = new finfo(FILEINFO_MIME);
$mime_type = $fi->buffer(file_get_contents($upload));

results in 'application/ogg'

My site accepts vouchers for herpetology records, but only image and 
audio. I do not wish to support video vouchers, but if an Ogg Theora 
file is uploaded, it also produces the mime type 'application/ogg' when 
looked at with finfo class.

I need a way to distinguish ogg/vorbis from other types of ogg files, 
and it really needs to be w/o exec or system calls as they are currently 
disabled for security and I do not want to re-enable them.

Is there maybe a pcre extension or something designed to look at vorbis 
tags that could potentially be used to verify the file is ogg vorbis?

After upload I do transcode (from ogg to mp3 and mp3 to ogg so that 
html5 audio with flowplayer fallback works) by cron job that pulls new 
audio vouchers out of database, and I could (and currently do) check 
there, but all record submissions require at least one voucher and I 
would rather catch non ogg vorbis ogg files on submission before the web 
app creates the record in the first place.

Thanks for suggestions.


More information about the Vorbis mailing list