Results 1 to 3 of 3
Apr 12, 2011, 14:10 #1
- Join Date
- Apr 2011
- 0 Post(s)
- 0 Thread(s)
Delete thumbnail and regular images from folder using php
I don't know very much about php, but does anyone know how to delete images and also to download them to the computer when the user selects it?
The images are located in my folder/directory. Also, I want to delete both the thumbnail and the regular image.
I'm really new to php so this is still rather confusing. I have seen forums saying to use the unlink function, but I don't really know how to implement that into my code. Does it go into the upload and resize code? or does it have its own page? If possible, give me an example
Apr 12, 2011, 14:15 #2
First you should probably give us your code so we can understand what you're trying to do and how you're getting it done so far.
You say you want to use PHP to delete a file in a directory on your web server?
Here is a simple usage of the unlink() function that accomplishes that:
// delete.php <?php unlink('test.html'); ?>
Now. Are you trying to delete a file when a user clicks a button or something? Please provide more info so we can further help.
Apr 12, 2011, 14:18 #3
- Join Date
- Dec 2005
- Cambridge, England
- 71 Post(s)
- 3 Thread(s)
As you say to delete a photo use unlink. Basicaly you need to feed the name and location of the image to delete. This can be done via a form of some sort using direct filename input or a table with check boxs.
// Image name from a form
$delete = 'image to delete';
// Delete the images