PHP: Delete File / Erase File / Remove File

As long as the owner of the php script has the necessary privilege to delete a file, the php script has the ability to delete it.

To delete a file with PHP, use the unlink() function:

unlink('tmpfile.txt') or die('Unable to delete the file');

It returns true if the deletion is successful and false otherwise.

Related Posts:

Google

Leave a reply

Google

Good Boys

Do NOT subscribe, I’m a shameless self-promoter!

Thesis Theme for WordPress:  Options Galore and a Helpful Support Community

We are …

We write with …

Written with Windows Live Writer

We appreciate your …