Page 1 of 1
Editing Files with Php
Posted: Mon May 26, 2003 12:57 am
by Forlorn
I have a problem, I want to allow users to edit txt files on the server but I can't find a command to do that via php. I know I can write to files and read them but what if the user wants to remove things from the file. I want the user to have full control of the file. They should be able to edit everything in a textbox and just click sumbit for the changes to take effect. I can't seem to figure out how to do that however. Can someone please help me

?
Posted: Mon May 26, 2003 1:06 am
by delorian
I think, that some solution may by putting everything from the file to a textarea in html form. Then after the user's correction, the whole new content will be write to that file, erasing existing data. That's the simplest thing to do, I think

Posted: Mon May 26, 2003 1:32 am
by coolpravin
Try to use fread and fwrite.
If you want to replace origianl content
then fopen is the best solution for you.
Check it in manual
fopen
fopen
(PHP 3 <= 3.0.18, PHP 4 >= 4.0.0)
fopen -- Opens file or URL
Description
Code: Select all
<?php
int fopen (string filename, string mode [, int use_include_path])
?>
Posted: Mon May 26, 2003 3:11 am
by Forlorn
Thanks Delorian, I can't believe I didn't think of that
