[Phpwm] How to create a page on a server from a browser

James Blizzard jim at acidhl.co.uk
Mon May 1 00:10:25 BST 2006


You can also delete files using unlink() as long as the directory has
the correct permissions.

Jim

-----Original Message-----
From: Andrew Lewis [mailto:andrew at monkeysailor.co.uk] 
Sent: 30 April 2006 23:59
To: phpwm at mailman.lug.org.uk
Subject: Re: [Phpwm] How to create a page on a server from a browser


Ray Masa wrote:

> Hi all,
>
> I am developing a web based application where I can create files on
> the server via the web browser. So that users can create and edit 
> .html files. I will have a text box on the web page which will be used

> to name the page (e.g. about.html) and a submit button. When the 
> submit button is clicked, a page (about.html) will be created on the 
> web server (apache).
>
> Any ideas how to do that using PHP?

file access is fairly straight forward in PHP - as an example:

$outfile = "<b>Some HTML text</b>";
$fh = fopen("default.html", 'w') or die("can't create default.html
file"); fwrite($fh, $outfile); fclose($fh);

will open a file, write the contents of $outfile to the file, and then 
close the file or die with an error message if it fails. You can just 
tie this in with the submit button. There's an example of this (loading 
a config file) at www.monkeysailor.co.uk/scanui/config.php

hope this helps
spline

_______________________________________________
Phpwm mailing list
Phpwm at mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/phpwm







More information about the Phpwm mailing list