Hi I want users to be able to upload new images that overwrite old images but I am struggling. The original upload and naming works fine but I want any new images to have the same name, so I unlink the original before uploading the new image, is this the correct way to do it?
If it is then I am doing something wrong as it does not put the new image in. I think it may be something to do with unlinking, I don't really get how to do it, the file $new_file_name is in /upload/ and here is the code I have:
if(file_exists("upload/' . $new_file_name . '")) unlink("upload/' . $new_file_name . '");
I don't know how to put $new_file_name in there, could someone help?