Deleting Files from Folders on Server.

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!

Moderator: General Moderators

Post Reply
NotOnUrNelly
Forum Commoner
Posts: 61
Joined: Wed Mar 24, 2004 4:45 pm

Deleting Files from Folders on Server.

Post by NotOnUrNelly »

Hi All,

I have a small routine that allows me to upload images to certain folders on the webserver. This works fine so there is probably no need to show any code for this.

I also have an images database table that values are added to every time a picture is uploaded to the server. This tables holds things like, image title (text), jpgNo(int), calling pageId(int).

The two work toegether and when a page is diplayed the database is checked and the image is collected of from folder on the server and displayed on the page.

I want to create an admin page at the back end of my website. that lists images relevent to pages. I want to add a check box with a delete function next to each images to allow this image to be deleted.

I can manage to delete the value out of the database, so the image is no longer displayed on my page. What I have not done is tried to delete the image from the folder on the web server.

Can anyone tell me how this is done or pass me on any code to do this.

I have done a google search but cant really put my finger on it.

Many thanks
Jamie
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

NotOnUrNelly
Forum Commoner
Posts: 61
Joined: Wed Mar 24, 2004 4:45 pm

Post by NotOnUrNelly »

Many Thanks for that

J Bird,

I giv eit a go tonight after work.

No doubt I'll run into problems. So expect this post to be extended.

Thanks
Jamie
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

No probs.

Unlink() is easy to use, you should have no problem
Post Reply