I would like to remove a file from a folder in PHP, but I just have the path to this file, would it be ok to give the path to unlink? For example
unlink('path/to/file.txt');
If this doesn't work, the only way to get rid of those files would be to create a .php file in the path/to/ directory and include it somehow in my file an call a method there to remove the file, right?
Got an easy method for your question
Use this code to remove a file from a folder
$_SERVER['DOCUMENT_ROOT']
this can be used inside the unlink function
worked code
unlink($_SERVER['DOCUMENT_ROOT'] . "/path/to/file.txt");