PHP: Image uploading if fail
<p>I am having an upload image system.</p>

<p>You upload a image, then you crop it and press save.</p>

<p>If you cancel this procedure at after you uploaded the image, the image will remain on the server.</p>

<p>So therefore i tried my idea of making a column in db called "failImage", so when you upload the image, it stores the filename e.g 1111.jpg in the column. </p>

<p>So later if you cancel this procedure either by shutting down the website or something else, next time you visit, I made a function that checks if failImage is empty. </p>

<p>If it isn't then it deletes (unlink) the value in failImage(which is in this example 1111.jpg) and emptys the failImage column.</p>

<p>This works fine. </p>

<p>But...if you have two windows of my site, and on the 1)st one you upload a image, and then at the 2nd one you refresh the window(f5) the function i made, that unlink the value in failImage runs, and will then occur an error to the previous window you have open, when you try to crop and save it, as it says no such file or directory, as the second window has removed the image you were working with.</p>

<p>I have thought of an solution to this for some time, is there any way I can solve this?</p>
