Making sure an uploaded file meets requirements
<p>I have a website where I allow users to upload photos. For security purposes, I only want users to be able to upload either a jpeg, gif, or png file type. How would I go about writing these conditions?</p>

<p>What I have so far:</p>

<pre><code>if ($_FILES['media']['size'] != 0 &amp;&amp; //tests file type) {
    //the file is good, upload the file
}
</code></pre>

<p>Thanks!</p>
