is it checking files in server side?
<p>I have an application (http://helios.hud.ac.uk/u0867587/Files/Files.php)</p>

<p>If you open the application, click on the "Add Question" button. This will add a table row. Now in the file input select a file which is invalid (like a .txt file for example).Now click on the "submit Details" button, it will state in an alert an "Unsupported file type" for question 1. Now go back to file input and change file to a valid format (.png, .jpg, .jpeg or .gif) and then after you have done that click on the "submit Details" button again, this time a confirmation box appears stating a message and if you want to proceed.</p>

<p>Now this all works fine on client side but what I want is that when the user clicks on the "Submit Details" button, I want it to check if the file format is correct in server side as well as client side for security purposes.</p>

<p>What I don know is that if the code below is checking for the file on server side as well as in client side because no message is appearing from an echo if wrong file is chosen after submission on the top corner.</p>

<p>Below is the php code:</p>

<pre><code>if(isset($_FILES["imageFile"])) 
{ 

$allowedImageTypes = array("image/pjpeg","image/jpeg","image/jpg","image/png","image/x-png","image/gif");
$file = $_FILES['imageFile'];
$fileType = $file['type'];
if (!in_array($fileType, $allowedImageTypes)) { 
    echo "Unsupported file type";
}
else
{
    // Process the file
}
}
?&gt;
</code></pre>

<p>Below is code on how the file input and question number is added in each row:</p>

<pre><code>var qnum = 1;

function insertQuestion(form) {   


    var $tbody = $('#qandatbl &gt; tbody'); 
    var $tr = $("&lt;tr class='optionAndAnswer' align='center'&gt;&lt;/tr&gt;");
    var $qid = $("&lt;td class='qid'&gt;" + qnum + "&lt;/td&gt;");
    var $image = $("&lt;td class='image'&gt;&lt;/td&gt;");


            var $imagefile = $('&lt;input /&gt;')
        .attr({
            type: 'file',
            name: 'imageFile',
            class: 'imageFile'
        });

        $image.append($imagefile);

            var $imageclear = $('&lt;input /&gt;')
        .attr({
            type: 'button',
            name: 'imageClear',
            class: 'imageClear',
            value: 'Clear File'
        });

        $image.append($imageclear);


    $tr.append($qid);
    $tr.append($image);   
    $tbody.append($tr); 

}
</code></pre>

<p>Below is the table where the table rows are added into:</p>

<pre><code>&lt;form id="enter" action="&lt;?php echo htmlentities($_SERVER['PHP_SELF']); ?&gt;" method="post" onsubmit="return validateForm(this);" &gt;


&lt;div id="details"&gt;
&lt;table id="qandatbl" align="center"&gt;
&lt;thead&gt;
&lt;tr&gt;
    &lt;th class="qid"&gt;Question No&lt;/th&gt;
    &lt;th class="image"&gt;Image&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;/form&gt; 
</code></pre>
