|
Posted by bissatch on 09/07/05 14:42
Hi,
I am currently working on a content management system where a user can
fill in a form (title, keywords, link text etc. - all the initial
attibutes), which when submitted, will go onto create a web page.
The code is as follows:
$html = "<html>\n<body>\n<p>Hello World</p>\n</body>\n<html>";
$handle = fopen($_SERVER['DOCUMENT_ROOT']."/path/to/folder/".$filename,
"w");
fwrite($handle, $html);
fclose($handle);
Pretty basic, I think. I works for a few and then it just stops. I get
no error to say that 'could not create file' or 'file not found', it
just submits. Any reason for this? I have tried searching the C: drive
for the file but it cannot be found.
At the moment Im trying to figure out when it actually occurs but for
some annoying reason, it seems to be working now. I would prefer to be
assured that it wont occur again so just thought I would still post
something here just encase this problem is a known one.
Is fopen() the best solution for creating files? I was aware that it
was used to open an existing file but create one (?). Is this what it
was intended to do? Im sure it is, but its new to me.
Anyway, if anyone can offer any advice it would be much appreciated. Im
going to move onto another part until I resolve this bug. Thanks
Burnsy
Navigation:
[Reply to this message]
|