Hi guys
Im trying to make this uploadscript but cant get it to work fully
I want to upload txt,doc or pdf files and Im checking if it has the proper extension.
I also want to check the mimetype but then the script wont work, what am I doing wrong?
$file = $_FILES['Filedata']['name'];
if (preg_match("/\.(?:txt|doc|pdf)$/i", $file)){
$mime = $_FILES['Filedata']['type'];
if($mime == "application/msword" || $mime == "text/plain" || $mime == "application/pdf") {
//move the uploaded file
move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']);
}
}