Jump to content

PHP and .txt files


Recommended Posts

Hello,

 

I have a PHP script which updates a .txt file on my server with new text for a page on my website. Im using CuteFTP to upload files. I had been able run my PHP script from one folder using a windows server, but when i moved it to another folder supported by a linux server it wouldn't run. I know i need to change the permissions of the .txt file to 777 which i have done but the script stil will not run..

 

<?php
$loadcontent = "innertext.txt"; 
if($save_file) {
$savecontent = ($savecontent);
$fp = @fopen($loadcontent, "w");
if ($fp) {
fwrite($fp, $savecontent);
fclose($fp);
}
}
$fp = @fopen($loadcontent, "r");
$loadcontent = fread($fp, filesize($loadcontent));
$loadcontent = htmlspecialchars($loadcontent);
fclose($fp);

?>

<form method="post" action="<?=$_SERVER['PHP_SELF']?>" name="savecontent">
<textarea name="savecontent" cols="70" rows="25"><?=$loadcontent?>
</textarea>
<input type="submit" name="save_file" value="Save">  
</form> 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.