How to validate file upload field?
<p>I can't seem to validate file upload fields, here's my code:</p>

<pre><code>&lt;?php

    if (isset($_POST['submit'])) {
        if ($_POST['uploadFile']) {
            echo "File uploaded";
        } else {
            echo "No file attempted to be uploaded";
        }
    }

?&gt;

&lt;form action="" method="post" enctype="multipart/form-data"&gt;
    &lt;input type="file" name="uploadFile" /&gt;
    &lt;input type="submit" name="submit" /&gt;
&lt;/form&gt;
</code></pre>

<p>What is the mistake I'm making?</p>

<h2>EDIT</h2>

<p>Came up with my own solution, may not be the best but it works:</p>

<pre><code>if (isset($_POST['submit'])) {
    $fileUpload = $_FILES['uploadFile'] ['name'];
        if (strlen($fileUpload) &gt; 0) {
            echo "File uploaded.";
        } else {
            echo "No File attempted to be uploaded.";
        }
}
</code></pre>
