how can i upload .doc and .docx using a php script? my script works well on pdf and txt but for doc and docx its not uploading. i need the script to upload pdf doc docx and txt only.
below is my code
session_start();
$targetfolder = "testupload/";
$targetfolder = $targetfolder . basename( $_FILES['file']['name']) ;
$ok=1;
$file_type=$_FILES['file']['type'];
if ($file_type=="application/pdf" || $file_type=="application/msword" || $file_type=="text/plain") {
if(move_uploaded_file($_FILES['file']['tmp_name'], $targetfolder))
{
$_SESSION['message'] ="The file ". basename( $_FILES["file"]["name"]). " uploaded successfully.";
header("location:lecsubmit?done") ;
}
else {
$_SESSION['message']= "Sorry, your file was not uploaded.";
header("location:lecsubmit?error") ;
}
}
else {
$_SESSION['message']= "You may only upload PDFs, DOCXs, DOCs or TXT files..";
header("location:lecsubmit?error") ;
}