How to load .mp3 file in php only after checking, my .wav file loads easily
just print $_FILES["myfile"]["type"];
for a real mp3 file then copy the value and use it instead of audio / mp 3 because the MIME type of mp3 will not be "audio / mp3" I guess itsaudio/mpeg
Please check this Link because it is not recommended to depend on $_FILES["myfile"]["type"]
that sent by the browser.
Two things.
Check the size of your file .mp3
. Check the file type .mp3
if it is valid audio/mp3
. Try it print_r($_FILES);
.
$type = $_FILES["myfile"]["type"];
$size = $_FILES["myfile"]["size"];
if( ( ($type == "audio/mp3") || ($type == "audio/wav") ) && ($size < 20000000)) {
if(move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path) ) {
$result1=1;
}
}
Hope it helps.
source to share
You can check by evaluating the extension of the uploaded file or if you want to check the file level then you can use one of the pear packages https://pear.php.net/package/MP3_ID
source to share