File Upload Script Errors

I am new to PHP, and am working on a file uploader script in PHP. I know I need to incorporate more security measures. However, at this point, even if I upload a file, I get the “Sorry, only mp3 files are allowed to be uploaded.” What am I doing wrong? Following is my code. Thanks so much for your help!

First, here is the html:

Your first name:
What is your email address?
Who is the artist?
What's the artist's web address?

Upload audio here. If we like it, we will definitely play it.

Please choose a file:

Second, here is the PHP:

<?php $firstname = $_POST['firstname']; $email = $_POST['email']; $who_is_the_artist = $_POST['whoistheartist']; $webaddress = $_POST['webaddress']; $target_dir = 'uploads/'; $target_dir = $target_dir . basename( $_FILES['uploadFile']['name']); $uploadOk=1; if (file_exists($target_dir . $_FILES['uploadFile']['name'])) {echo 'Sorry, file already exists.'; $uploadOK=0; } if (!($uploadFile_type == 'audio/mpeg3')) {echo 'Sorry, only mp3 files are allowed to be uploaded.'; $uploadOK = 0; } if ($uploadOK == 0) {echo 'Your file was not uploaded.';} if (move_uploaded_file($_FILES['uploadFile']['tmp_name'], $target_dir)) {echo 'Thank you so much ' . $firstname . ' for your submission of ' . $who_is_the_artist;} else {'Sorry, there was an error uploading your file.';} ?>

The error firing is here:
[php]
if (!($uploadFile_type == ‘audio/mpeg3’))

{echo ‘Sorry, only mp3 files are allowed to be uploaded.’;
$uploadOK = 0;
}
[/php]
It’s not an error, per say, it’s actually doing what it’s supposed to do and that is not allow any file that is not mpeg3 format. So, if you try and upload and image etc. it will fail.

make sense?
Red :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service