I'm trying to create an upload form for my website- I want to restrict the allowed file types to WAV files and not allow any other file types. With the code I'm using, the form does not allow ANY file type. Why is this?
Here's my script:
<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if (!($uploaded_type == "audio/wav")) {
echo "You may only upload WAV files.<br>";
$ok=0;
}
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>
of course when I comment out the bit " if (!($uploaded_type == "audio/wav")).... " it allows all file types, which I do not want. Thanks