Necuima Posted July 10, 2015 Share Posted July 10, 2015 Hi, I am following the file upload process (pp 427 .....), a process I have used many times before A-OK. I am using the procedure to upload mp3 files but sometimes when I check the mime type, it is blank, thus the upload does not proceed, even though that same file will play perfectly in Windows Media Player. Can anyone shed any light on this? Any advice will be most appreciated and thanking you in anticipation. $allowed = array ('audio/mpeg', 'audio/mp3'); if (in_array($_FILES['upload']['type'], $allowed)) { // MIME type OK // now move/upload the new music file $music_file_name = "../music/music_" . $key . ".mp3"; if (!move_uploaded_file($_FILES['upload']['tmp_name'], $music_file_name)) { // move/upload was not OK // print a message based upon the error. etc.... P.S., My environment is Windows 7, 64 bit with Apache, PHP and MySQL. Link to comment Share on other sites More sharing options...
Larry Posted July 13, 2015 Share Posted July 13, 2015 Sorry, but I don't know much about the MIME type of MP3s and its peculiarities. Wish I could help, but I'd do the same thing you are: Google it! Link to comment Share on other sites More sharing options...
Necuima Posted July 14, 2015 Author Share Posted July 14, 2015 Hi Larry, Yes I've been doing that as you have correctly surmised :-) Thanks, and Cheers from Oz. Link to comment Share on other sites More sharing options...
Recommended Posts