Welcome Guest, Not a member yet? Register   Sign In
How do I delete a single file?
#1

[eluser]Unknown[/eluser]
Hey guys.

I've just recently started to learn CodeIgniter and have just begun playing with the file uploading class. I've been looking around a bit for how I can delete a single file which has been uploaded but all I've found is the function
Code:
delete_files()
which deletes all files in a directory..

So, how should I delete a single file?
#2

[eluser]CroNiX[/eluser]
regular php?

unlink('path/to/file');
#3

[eluser]LinkFox[/eluser]
Yeah don't be afraid to use regular PHP Smile

Unlink() is the the one you need...but remember you have to give unlink() an absolute path to the file not a URL or you could have people remotely deleting files via HTTP!




Theme © iAndrew 2016 - Forum software by © MyBB