Man I hope you have some ideas on this. I'm pulling my hair out. Been messing with this for hours.
I'm trying to get it to make a temporary backup of files as I edit them, so I can revert and the click of a button. So I'm taking it a step at a time.
My problem is.. fopen should be creating a file for me, and it works if i just use a regular filepath/name.. but if I try to name it off a variable that's passed to the page, it refuses to open it.
<?php
# get variables
if (isset($_POST['filetoedit'])) {
$filetoedit = $_POST['filetoedit'];
$newcontent = $_POST['newcontent'];
$newcontent2 = stripslashes($newcontent);
# get variables
#backup old
$backupfile = "/media/backup_drive/wwwbackups/temp$filetoedit";
echo $backupfile;
$fpb = fopen($backupfile, 'a+'

;
#fwrite($fpb, $newcontent2);
#fclose($fpb);
#backup old
#write new
#$fp = fopen($filetoedit, 'w+'

;
#fwrite($fp, $newcontent2);
#fclose($fp);
#writenew
}
?>
As you can see the writing new is commented out while I figure this out, and so is half the backup script. So what happens, it gets the variables, sets the $backupfile, echo's it correctly, then errors on the fopen, says /correct/path/to/filenamename.php is 'not a file or folder'.
Well I know that, you're supposed to be creating it!
I've tried every combo I can of different ways to get it to work. If I take out the variable and just put
fopen("some/path/file.log", 'w+'

;
it works. But I need it to go work off the variable.
Thoughts? Ideas?
Edit: I wonder if name is too long? I found something like :
[ENAMETOOLONG] The length of the filename exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.
..when describing scenarios that cause it to fail, but the page from 97 and I couldnt' find PATH_MAX in php.ini...
It ends up being something like /media/backup_drive/backups/wwwbackups/temp/123/456/another/path/hereisfile.php
-----signature-----
Every forum should have a Phases.
Bringing SSP back to life at
http://www.superstickphase.com !
Retired AC/AC2 - Phases Og'Maxim - Leafcull