Delete files in a directory using glob()
<p>I am trying to empty the content of a directory using glob() and foreach() using</p>

<pre><code>$files = glob('/upload/'.$id.'/temp/*.JPEG'); 
    foreach($file as $files){
    unlink($file);}
</code></pre>

<p>But I just keep getting 'Invalid argument supplied for foreach()'</p>

<p>Is this just a syntax error or can I not use unlink() in a foreach loop?</p>

<p>Also, just out of curiosity, will this code find all files in a directory?</p>

<pre><code>$files = glob('/upload/'.$id.'/temp/*.*');
</code></pre>
