I am creating a page which will allow me upload data and an mp3 file but I need some help. If the file type does not match the condition, I need the script to stop execution and not add the data to the db and the file to the directory. Everything works fine other than the checking of file type and stopping the script.
Here is what I have right now:
// check file type
if (!($file=="audio/mp3")):
echo "You may only upload mp3 files.<br>";
endif;
This does not work. When I upload a file that is not a mp3 file - I get the error message "You may only upload mp3 files." but the script still executes and the file is uploaded.
When I upload an mp3 file - I get the error message "You may only upload mp3 files." and the script continues doing what it is suppose to do.
Any help on this will be greatly appreciated. Thanks