trecool999 Posted June 21, 2007 Share Posted June 21, 2007 Ok, I have an MP3 Upload site, but when a user logs in and uploads a file, more than half of the time the MP3's MIME type returns absolutely nothing! I don't think it's the code, because some of the music uploads well, it's just about 65% has no MIME! Any explanation? Quote Link to comment https://forums.phpfreaks.com/topic/56606-_filesfiletype-returns-nothing/ Share on other sites More sharing options...
trecool999 Posted June 21, 2007 Author Share Posted June 21, 2007 Please help, this is urgent :-\. Quote Link to comment https://forums.phpfreaks.com/topic/56606-_filesfiletype-returns-nothing/#findComment-279571 Share on other sites More sharing options...
trecool999 Posted June 21, 2007 Author Share Posted June 21, 2007 Anybody!? Quote Link to comment https://forums.phpfreaks.com/topic/56606-_filesfiletype-returns-nothing/#findComment-279635 Share on other sites More sharing options...
trecool999 Posted June 22, 2007 Author Share Posted June 22, 2007 C'Mon! :'( Quote Link to comment https://forums.phpfreaks.com/topic/56606-_filesfiletype-returns-nothing/#findComment-279683 Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 the piece of code plzz and remember the max limitation of uploading file be sure about that ASTIG!! Quote Link to comment https://forums.phpfreaks.com/topic/56606-_filesfiletype-returns-nothing/#findComment-279687 Share on other sites More sharing options...
audiokiwi Posted June 22, 2007 Share Posted June 22, 2007 First off, check to make sure you didn't misspell anything. From the PHP Manual The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted. This means that the browser send the type. Some browsers don't send them. Try using a different browser. Type will be empty if there is an error uploading the file. Check the value of $_FILES['X']['error'] to make sure that everything is all good. See http://www.php.net/manual/en/features.file-upload.errors.php if there is an error. If none of the above, you'll need to post your code here so we can see it. Quote Link to comment https://forums.phpfreaks.com/topic/56606-_filesfiletype-returns-nothing/#findComment-279707 Share on other sites More sharing options...
trecool999 Posted June 22, 2007 Author Share Posted June 22, 2007 function Query() { if($_FILES['File']['size'] <= 500000) { echo 'File Size Ok. ' . $_FILES['File']['size'] . '<br />'; } else { echo 'File Too Big!<br />'; } $MIME = array('audio/mpeg', 'audio/mp3'); if(in_array($_FILES['File']['type'], $MIME)) { echo 'File Type Ok.<br />'; } else { echo 'File Isn\'t MP3 Format: ' . $_FILES['File']['type'] . '<br />'; echo 'Temp File Stored As: ' . $_FILES['File']['tmp_name'] . '<br />'; } if(move_uploaded_file($_FILES['File']['tmp_name'], 'Music/' . mysql_insert_id() . '.mp3')) { echo 'Success!'; } else { echo 'Error!'; } } Only some MP3's uploaded. Quote Link to comment https://forums.phpfreaks.com/topic/56606-_filesfiletype-returns-nothing/#findComment-279919 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.