I decided that I will start experimenting with PHP's File functions today in preparations for a larger project I will embark on later this week, but now I have a problem.
PROBLEM:
When I run the script below, after I hit the SUBMIT button, I get this error:
Warning: fopen("test.txt", "w+") - Permission denied in /host/local/home/site/subdomain.domain.com/TEST/filesystemtest.php on line 25
File not Found, or other error occured!
On line 25, the code calls the file open function (fopen).
Here is the code that I came up with to test these functions out:
<?PHP
######################################
## This is a test of File Functions ##
######################################
Print ("
<html>
<head>
<title>File Functions Test</title>
</head>
<body>
<form method='post' action='$PHPSELF'>
<input type='text' name='input_test'>
<input type='submit' name='submit' value='Submit to Test the File'>
</form>
");
IF (isset($submit)) {
$filename = "test.txt";
$fileopen = fopen($filename,"w+") or die("File not Found, or other error occured!<br>");
$filewrite = fwrite($fileopen, $input_test) or die("Could not Write to file!!<br>");
fclose($fileopen);
}
print ("
</body>
</html>
");
?>
Can someone help me out in figuring out what I am doing wrong? I have tried using relative paths as well as complete paths from root, and even paths from the system. I am VERY vew to the file system capabilities in PHP. Any help would be greatly appreciated.