I have created an ajax image upload system. When the user selects the image he wants to upload, the image is checked for security reasons and then uploaded to a file folder. The image is then displayed through the path of that file folder on ajax callback. The problem is that I want the image to be uploaded to the file AFTER the user has clicked a button. This would force me to rely on the temporary path file of the image, $_FILES['file']['tmp_name']
as the source of the image to be displayed. However, that doesn't work.
My question is this. If I can't use the temporary file path as the image source for the uploaded image, what would be my other options? I guess I could when the submit button is clicked move the file AGAIN and delete the old image, but there is the possibility the user might upload the file, exit the browser, and leave the image in the folder forever.