southbeach
Programmer
I am working on a very simple script and it is giving me a hard time
After running the script, web.log has following content
According to php.net, the above syntax should work. Directories and file are valid.
Running on MS-XP ... I am able to create directories using mkdir() within the same directories where I am moving files from/to (and failing to), so permission is not an issue.
What say you?
Thanks!
Code:
$fromfile = './files/'.$frompath.'/'.$filename;
$tofile = './files/'.$topath.'/'.$filename;
$ScriptName=$_SERVER['PHP_SELF'].': ';
$LogFile=fopen("c:/temp/web.log","a+");
if($LogFile) { $LogTxt=fputs($LogFile,$ScriptName."From File: ".$fromfile."\r\n"); }
if($LogFile) { $LogTxt=fputs($LogFile,$ScriptName."To File: " .$tofile."\r\n"); }
if(!rename($fromfile, $tofile)) {
if($LogFile) { $LogTxt=fputs($LogFile,$ScriptName."Unable to move files ...\r\n"); }
$objResponse = new xajaxResponse();
$objResponse->alert("Unable to move document " . $fromfile . " to " . $tofile . "!");
return $objResponse;
} else {
OpenDB('docsdb');
$sql = 'UPDATE docs SET
`catid` = "' . $dirid . '",
`path` = "' . $topath . '"
WHERE id = ' . $docid . ' LIMIT 1;';
DoQuery($sql);
}
After running the script, web.log has following content
Code:
/webdocs/index.php: From File: ./files/Sales/arrow.png
/webdocs/index.php: To File: ./files/Accounting/arrow.png
/webdocs/index.php: Unable to move files ...
According to php.net, the above syntax should work. Directories and file are valid.
Running on MS-XP ... I am able to create directories using mkdir() within the same directories where I am moving files from/to (and failing to), so permission is not an issue.
What say you?
Thanks!