Jump to content
Larry Ullman's Book Forums

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.
Link to comment
Share on other sites

 Share

×
×
  • Create New...