I\'m struggling to make this upload code work for a docx file, it works okay for doc and pdf..
$allowedExts = array(\"pdf\", \"doc\", \"docx\");
$extension =
There is another way to do the task. Just check the file type and then you can work further.
Here is code to check the filetype.
$target_dir = "uploads/";
$filename= $_FILES["fileupload"]["name"]; //gets filename with type
$target_file = $target_dir . basename($filename); //uploads/file.type
echo $target_file;
$extension= pathinfo($target_file,PATHINFO_EXTENSION);
$imageFileType = strtolower($extension);
if(strcmp($imageFileType,"docx")==0){
echo "Its word file";
}