I am trying to unlink a file but the PHP unlink function seems to refer to the directory of the script file I am using rather then where the file is.
I am using change directory (chdir) to change the directory and yet this is seemingly having no effect:
chdir("themes");
$file_path = getcwd()."/".$_GET["file_path"]."/";
$deleted_file=$file_path.$data["file_name"];
$fh = fopen($deleted_file, 'w') or die("Can't open file");
fclose($fh);
unlink($deleted_file);
The error I get is the following:
Warning: fopen(/home/mow/public_html/mysite/themes/_default/admin/testfile.php/): failed to open stream: No such file or directory in /home/mow/public_html/mysite/themes/_default/admin/file_manager.php on line 223