title: Delete Image Files From Server
body: <p>I wonder whether someone may be able to help me please.</p>
  <p>I've put together <a href="http://www.mapmyfinds.co.uk/development/deletetest.php#/0" rel="noreferrer">this</a> page which allows users to view their uploaded images in a gallery format.</p>
  <p>I'm now wanting to add the delete functionality to each image. I've created the button and the Javascript behind it, but I'm really not sure how to link the 'button click' with the actual physical deletion of the file.</p>
  <p>The images aren't stored in a database but are in two folder locations on my server, in the following structure:</p>
  <p><code>UploadedFiles/username/locationid/imagename</code> and</p>
  <p><code>UploadedFiles/username/locationid/Thumbnails/imagename</code></p>
  <p>I'm relatively new to PHP and I'm now reaching the limits of my knowledge, but certainly willing to learn. From the documentation I've read I think I'm correct in saying that the <code>unlink</code> method is the correct command to use?</p>
  <p>But what I'm finding really difficult is telling the code to find the folders with the <code>username</code> and <code>locationid</code> folders which match the current <code>username</code> and <code>locationid</code> and then delete the files which match the <code>$source</code> name variable.</p>
  <p>I just wondered whether someone could perhaps provide some guidance please on how I may go about this.</p>
  <p>Many thanks and kind regards</p>