PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
my product records have an associated field which points its product image (which was uploaded on the creation of the product record). now i have an edit form to change any of the initial values set upon creation of the record, which also has the option of changing the image. this part is simple enough with an upload form BUT it would be silly to not deal with the redundant image that was replaced as it is just going to waste server space. i would like to know if there is a way to remove that image following a successful edit (the path to image is known).
First off, what does it do when you use that code there? Secondly, you want want to take a newly uploaded image and replace it with the one that was in its place? Are you using a mySQL db I presume.
Be extremely careful with the usage of unlink() you have there ~sh33p1985. A malicious user could request that your script erase any file on your server.
security measures are in place the area is protected only one person will have access to the changing the images. and ofc the parameter passed to unlink will be the old image, no way anything else will be able to passed to it.