, - mp3 mime audio/mpeg, , mime_content_type application/octet-stream / . ( ) ( /), audio/mpeg - mime mp3 rfc3003:
array('trackfile' => 'required|mimes:audio/mpeg,mp3')
, mime, - :
$file = Input::file('upload');
if($file->getMimeType() == 'audio/mpeg') {
}
else {
}
Update:
, mp3 getID3, Php PECL extension id3, , ID3 tag , ββ title, artist, album, year, genre ..
, (getid3) app, app/libs/ getid3 libs, composer.json classmap autoload, :
"app/tests/TestCase.php",
"app/libs/getid3"
composer dump-autoload . , :
$file = Input::file('upload');
$path = $path = $file->getRealPath();
$id3 = new getID3();
$tags = $id3->analyze($path);
if(is_array($tags) && array_key_exists('audio', $tags)) {
dd($tag['tags']);
}
mp3 :
array (size=2) 'id3v1' =>
array (size=6)
'title' =>
array (size=1)
0 => string '46. Piya Basanti' (length=16)
'artist' =>
array (size=1)
0 => string '(Freshmaza.com)' (length=15)
'album' =>
...
PECL, ( ) :
pear install pecl/id3
$tags = id3_get_tag( "path/to/example.mp3" );
print_r($tag);
:
Array
(
[title] => DN-38416
[artist] => Re:\Legion
[album] => Reflections
[year] => 2004
[genre] => 19
)
Php.