clicking a link to delete a file

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
neobolt
Forum Newbie
Posts: 9
Joined: Wed Apr 14, 2004 7:43 pm

clicking a link to delete a file

Post by neobolt »

I'm trying to create a link, so when the user clicks the link it will delete a file from a directory.

I've been messing around with the unload command with no success.

This is so a member can download a text database file. Then I need them to click the delete database link so that the database file gets deleted, so when new information is sent, a new database is created.

All I need to know is how to delete a file from my server by clicking a link.

Thanks
User avatar
doggy
Forum Commoner
Posts: 80
Joined: Tue Dec 09, 2003 5:01 am
Location: South Africa

Post by doggy »

this link will help you out fopen http://za2.php.net/manual/en/function.fopen.php
use fopen to open to that dir and then delete the file.
Hope this helps
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

You use the unlink() function to delete a file via PHP. But you have to have (1) Permissions to do so and (2) Give it the full path to the file.
Post Reply