jQuery,PHP-upload text file,doc/docx,ppt/pptx,pdf
<p>How can I upload <strong>txt, doc/docx, ppt/pptx, pdf</strong> and restrict all other file types while uploading file using php and jquery? Can i do it with jQuery also?</p>

<p>I have tried this.</p>

<pre><code>$allowedExts = array("doc", "docx", "pdf", "txt");
$extension = end(explode(".", $_FILES["file"]["name"]));
if (($_FILES["file"]["type"] == "application/msword")
|| ($_FILES["file"]["type"] == "application/pdf")
|| ($_FILES["file"]["type"] == "application/txt") 
&amp;&amp; in_array($extension, $allowedExts)){}
</code></pre>

<p>I need it in JQuery or a better way in PHP. </p>
