July 24, 200818 yr Hi, I am having trouble using PHP to delete a file on my server. I have used the move_uploaded_file(); function to upload an image to a folder. I now need for people to be able to delete the image. I have read that the unlink(); function should do the job but I cannot work out how? Anybody know? Cheers Rich.
July 24, 200818 yr Author I think WDF can be bad for me, at every hurdle I immediately jump the gun and come to the forum for advice, before I thoroughly research the issue myself! Well, I've managed to sort it now cheers!
July 24, 200818 yr Lol yup, I'm guilty of that one. One thing that is useful though, if you do jump the gun or solve your own problem, share the solution anyway, if you wouldn't mind? It means that anyone looking for the answer who stumbles across this thread won't be disappointed Just a suggestion
July 24, 200818 yr Author Yes, sorry I normally do write the solution! Your right Mihai, it was an issue with the file path, or at least how I built the file path using various variables (I guess that's about all that can go wrong!) for those that don't know how the unlink(); function works it's pretty straight forward: $file_path = 'directory/filename'; unlink($file_path); This will delete whichever file the $file_path points to. lol looking at that it couldn't be easier!
Create an account or sign in to comment