Jump to content
Larry Ullman's Book Forums

Recommended Posts



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.
P.S., My environment is Windows 7, 64 bit with Apache, PHP and MySQL.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...