File write problem
Posted: Sat Jul 14, 2007 4:23 pm
feyd | Please use
******************
When submitted that loads "track_status_update.php" with this code in it
******************[/syntax]
******************
And that's where it stops working. It should just write to "track_status.php." But the fopen function is denied.
Thanks everyone,
infl8
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi everyone. I'm pretty new to php so bear with me, I'm sure this is a simple fix.
I wrote a really simple script that uses some form data to write a file. It works just fine on my computer with Apache and PHP 5, but when I upload it to a PHP enabled server it doesn't work. I'm pretty sure it's because I didn't put anything in the script to log into the the web space (or something like that). How would I go about fixing this?
This is the error message I'm getting.
Warning: fopen(track_status.php) [function.fopen]: failed to open stream: Permission denied in (directory which I'm not going to show here)/track_status_update.php on line 62
can't open file
Here is my code..
******************
[syntax="html"]<form action="track_status_update.php" method="post">
Title<br />
<input name="header" type="text" value="" size="30"><br /><br />
Update<br />
<textarea name="message" rows="3" cols="40"></textarea><br />
<input type ="submit" name="submit" value=" Update Track Status Note "><br />
<input type ="reset" name="reset" value=" Reset Form ">
</form>When submitted that loads "track_status_update.php" with this code in it
******************[/syntax]
Code: Select all
<?php
$header1 = "<h1>";
$header2 = "</h1>";
$myFile = "track_status.php";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "<h2> </h2>";
fwrite($fh, $stringData);
$stringData = $header1 . $_POST["header"] . $header2;
fwrite($fh, $stringData);
$stringData = $_POST["message"];
fwrite($fh, $stringData);
$stringData = "<br /><br />";
fwrite($fh, $stringData);
fclose($fh);
?>And that's where it stops working. It should just write to "track_status.php." But the fopen function is denied.
Thanks everyone,
infl8
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]