Jump to content
Larry Ullman's Book Forums
Sign in to follow this  

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
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.

Guest
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.

Loading...
Sign in to follow this  

×
×
  • Create New...