|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-03-22 10:25 UTC] info at djdb dot be
Description:
------------
When you move a file like code
public function Movetobackup($file){
rename($this->HOME.$this->download.$file, $this->HOME.$this->backup.$file);//TODO BEFORE UPLOAD UNCOMMENT
if($this->debug){print "!!! $file moved!!!";}
//touch($dest, filemtime($src));//reset of the time of a file
}
then wil i lost te file when php has not access to the dest dir.
so i think it is a important issiue
Test script:
---------------
class classe1 {
private $dir = "";
public function Movetobackup($file,$dir){
rename($this->dir.$file, $dir.$file);//TODO BEFORE UPLOAD UNCOMMENT
if($this->debug){print "!!! $file moved!!!";}
//touch($dest, filemtime($src));//reset of the time of a file
}
}
$test = new classe1();
$test->move("myfile.txt","/newdir");
Expected result:
----------------
Actual result:
--------------
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 03:00:01 2025 UTC |
Nope. This issues a warning message when trying to do the move, and doesn't remove the source file <?php file_put_contents("text", " "); rename("text", "/text"); PHP Warning: rename(/text): failed to open stream: Permission denied in /tmp/file.php on line 3