quick mp3 upload script problem
Posted: Mon Oct 05, 2009 9:23 pm
Hey guys, quick problem, I have this upload script and when I choose to upload an mp3 it just echos 'Please upload a mp3 file!' even if it is one. The other functions seem fine. Could this be a problem with the form? The input is part of a large form.
form: mp3 input
<form name="titleform" action="" method="POST" enctype="multipart/form-data">
<input type="file" name="file" size="40" />
</form>
Code: Select all
if ($_FILES['file']['name'] != "") {
if (($_FILES['file']['type'] == "audio/mpeg") || ($_FILES['file']['type'] == "application/force-download")) {
if ($_FILES["file"]["size"] < 4097152) {
move_uploaded_file($_FILES["file"]["tmp_name"], "usercontent/$user/audio/" . $_FILES["file"]["name"]);
echo "File has been stored in your uploads directory.";}
else { echo "Please upload a file that is under 4 mb!";return;}
} else {
echo "Please upload a mp3 file!";
return;
exit;}
} else { echo "Please enter a file.";return;}<form name="titleform" action="" method="POST" enctype="multipart/form-data">
<input type="file" name="file" size="40" />
</form>