Pergunta

Users upload mp3 files and I need to get their length. What is the least-effort way to do this in PHP? By least effort I mean whatever way requires the least amount of code and with as little non-native PHP functions as possible.

I tried implementing the code suggested in the answer below:

<?PHP
$f = 'numbers/4.mp3';
$m = new mp3file($f);
$a = $m->get_metadata();

if ($a['Encoding']=='Unknown')
    echo "?";
else if ($a['Encoding']=='VBR')
    print_r($a);
else if ($a['Encoding']=='CBR')
    print_r($a);
unset($a);
?>

But I'm getting this error:

Fatal error: Class 'mp3file' not found in /home/a1865444/public_html/save-audio.php on line 3

How do I get around this?

Foi útil?

Solução

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top