I have a form for uploading audio files. I have made the validation only allow real audio, wma, mp3 files. the real audio and wma files work fine but when i try to upload the mp3 file it doesnt work. I am not completely sure what all the MIME types are for mp3 files but i have tried a few that i have found and the do not work. Here is my code:
if (!empty($_FILES['sermon']['type'])){
$extension = "";
if($_FILES['sermon']['type'] == "audio/x-ms-wma"){ $extension = "wma"; }
elseif($_FILES['sermon']['type'] == "audio/x-pn-realaudio"){ $extension = "ra"; }
elseif($_FILES['sermon']['type'] == "audio/x-mp3"){ $extension = "mp3"; }
else{
$errors['sermon'] = "Your file is not a supported format. Please upload .wma, .mp3, and .ra files
only!";
}
$filename = $filename . "." . $extension;
$serverpath = $dirToSaveIn . "/" . $filename;
echo "filename: " . $filename . "<br>";
echo "serverpath: " . $serverpath. "<br>";
$webpath = $webpath . $filename;
$move_result = move_uploaded_file($_FILES['sermon']['tmp_name'], $serverpath);
}