Is my app checking files on server side?
<p>I have application <a href="http://helios.hud.ac.uk/u0867587/Files/Files.php" rel="nofollow">here</a></p>

<p>What I want to know is that is this application even checking the files on server side for file type?</p>

<p>To use app click on "Add Question" button to add a couple of rows and in file input select a file and then click on "Submit Details" button. The alert from client side will display an alert if file is valid or not. But is it checking it in server side? Do I even need a server side check?</p>

<p>Below is full code:</p>

<p>JavaScript: </p>

<pre><code>&lt;script type="text/javascript"&gt;


    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); 

    }


    function validation() {

        var _qid = "";
        var _msg = "";

        var questionsAdded = $('tr.optionAndAnswer').length;

        var allowedTypes = ["jpg", "jpeg", "gif", "png", "tif"];


        var alertValidation = "";
        // Note, this is just so it's declared...
        $("tr.optionAndAnswer").each(function() {


            _qid = $("td.qid",this).text();
            _msg = "You have errors on Question Number: " + _qid + "\n";


             $(".imageFile",this).each(function() {

        var path = $(this).val();
        var ext = path.substring(path.lastIndexOf('.') + 1).toLowerCase();

                  if($(this).val().length) {

            if ($.inArray(ext, allowedTypes) &lt; 0) {
            alertValidation += '\n\u2022 Unsupported file type';
            }
        }

             if (alertValidation != "") {
                    return false; //Stop the each loop 
                }

        });

            if(alertValidation != ""){
                return false;
            }
        });


        if (alertValidation != "") {
            alert(_msg + alertValidation);
            return false;
        }

        return true;
    }

                 function showConfirm(){

             var confirmMsg=confirm("Make sure that your details are correct, once you proceed after this stage you would not be able to go back and change any details towards Questions, Options and Answers for your Session." + "\n" + "\n" + "Are you sure you want to Proceed?" + "\n" );

             if (confirmMsg==true)
             {
             submitform();   
         }
    }

                function submitform()
                {

            var sessionMarksO = document.getElementById("sessionMarks");

              sessionMarksO.submit();

                }


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

<p>PHP:</p>

<pre><code>    &lt;?php

    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;

    &lt;/head&gt;

    &lt;body&gt;

    &lt;form enctype="multipart/form-data" id="enter" action="&lt;?php echo htmlentities($_SERVER['PHP_SELF']); ?&gt;" method="post" onsubmit="return validateForm(this);" &gt;
    &lt;div id="detailsBlock"&gt;


    &lt;table id="questionBtn" align="center"&gt;
    &lt;tr&gt;
    &lt;th&gt;
    &lt;input id="addQuestionBtn" name="addQuestion" type="button" value="Add Question" onClick="insertQuestion(this.form)" /&gt;
    &lt;/th&gt;
    &lt;/tr&gt;
    &lt;/table&gt;

    &lt;/div&gt;
    &lt;hr/&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; 


    &lt;form action="session_marks.php" method="post" id="sessionMarks"&gt;

    &lt;p&gt;&lt;input id="submitBtn" name="submitDetails" type="submit" value="Submit Details" onClick="myClickHandler(); return false;" /&gt;&lt;/p&gt;

    &lt;/form&gt;

             &lt;script type="text/javascript"&gt;

    function myClickHandler(){
         if(validation()){
                    showConfirm();
         }
    }

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

<p>If it is not checking it server side, then what do I need to do to be able to check the files in server side?</p>
