File manipulation with PHP
Posted: Thu Oct 24, 2002 5:58 pm
I'm trying to do something relatively simple(at least it should be!). I want to take a file that is below the web directory(not accessible) and copy it up into the web directory so that it can be accessed. This needs to be called inline in a php script so that I can copy the file - access the file in an active x script - then delete the file. I'm at then end of my rope and a newbie to boot! Based on the reading I've done this should work but it keeps failing. My only thought is that it's looking in a different path than I think it is - any help would be greatly appreciated.
Code: Select all
<?
$orig_filename = "test.html";
$success = @copy($orig_filename, $orig_filename.'.bak') or die("Couldn't copy file.");
if ($success) {
$msg = "Copied $orig_filename to $original_filename.'bak'";
} else {
$msg = "Could not copy file.";
}
?>
<HTML>
<HEAD>
<TITLE>Copy a File</TITLE>
</HEAD>
<BODY>
<? echo "$msg"; ?>
</BODY>
</HTML>