How would I add a restriction to only allow, word, pdf and notepad document to be sent with this form script.
<?php
if(isset($_POST['submit']))
{
//Deal with the email
$to = '[email protected]';
$message = strip_tags($_POST['CV Submitted']);
$attachment = chunk_split(base64_encode(file_get_contents($_FILES['file']['tmp_name'])));
$filename = $_FILES['file']['name'];
$boundary =md5(date('r', time()));
$subject = "CV Upload Form";
$message = "Someone submitted the following information from our cv upload form.
Name: ".$_POST["name"]."
Email: ".$_POST["email"]."
Telephone: ".$_POST["number"]."
Sector: ".$_POST["sector"]."
Comments: ".$_POST["Comment"]."
";
$message_html = "
Someone submitted the following information from our cv upload form.
Name: ".$_POST["name"]."
Email: ".$_POST["email"]."
Telephone: ".$_POST["number"]."
Sector: ".$_POST["sector"]."
Comments: ".$_POST["comment"]."
// this splits the file name up
$parts = explode(’.’, $uploadedDoc );// this splits ythe file name up
// get the file ext
$fileExt = strtolower(end($parts)); // this gets the extension after the last . and change all the extensions to lower case .
$allowedExt = array(“doc”,“text”,“pdf”);
if(in_array($fileExt,$allowedExt)) {
echo "file ext is ok ";
}else{
echo “Please only upload .doc,.txt,.pdf”:
}