note 85938 added to function.unlink

From: Date: Thu, 25 Sep 2008 14:04:46 +0000
Subject: note 85938 added to function.unlink
Groups: php.notes 
Request: Send a blank email to php-notes+get-144699@lists.php.net to get a copy of this message
To anyone who's had a problem with the permissions denied error, it's sometimes caused when you try to delete a file that's in a folder higher in the hierarchy to your working directory (i.e. when trying to delete a path that starts with "../"). So to work around this problem, you can use chdir() to change the working directory to the folder where the file you want to unlink is located. <?php $old = getcwd(); // Save the current directory chdir($path_to_file); unlink($filename); chdir($old); // Restore the old working directory ?> ---- Server IP: 69.147.83.197 Probable Submitter: 124.104.117.97 ---- Manual Page -- http://www.php.net/manual/en/function.unlink.php Edit -- https://master.php.net/note/edit/85938 Del: integrated -- https://master.php.net/note/delete/85938/integrated Del: useless -- https://master.php.net/note/delete/85938/useless Del: bad code -- https://master.php.net/note/delete/85938/bad+code Del: spam -- https://master.php.net/note/delete/85938/spam Del: non-english -- https://master.php.net/note/delete/85938/non-english Del: in docs -- https://master.php.net/note/delete/85938/in+docs Del: other reasons-- https://master.php.net/note/delete/85938 Reject -- https://master.php.net/note/reject/85938 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#144699) next »