[thelist] writing to file in php problem
Tom Dell'Aringa
pixelmech at yahoo.com
Mon Jan 6 17:05:01 CST 2003
--- Mike Migurski <mike at saturn5.com> wrote:
> >have this simple code:
> >-----------------------------------
> >$filename = "myfile.php";
> >
> >$body = "<html></html>";
> >
> >$handle = fopen($filename,'w+');
> >$string = $body;
> >fputs($handle, $string);
> >fclose($handle);
> >-----------------------------------
> >That's all that is there..won't work. Keep getting an empty file
> >(nothing is written). This exact code works in other pages I
> >have..any ideas?
>
> Hard to say without more info - the file gets created? It turns up
> empty?
> What's the return value of fputs()?
>
> I tried it here, and of course it worked fine. What are the
> permissions of
> the directory you're in?
The permissions are 777. I created the file empty and placed it in my
directory, so its there. (This is how I did it before.)
Removing the file gives me errors, I assumed the file had to be there
first.
Doing this: $x = fputs($handle, $string);
Gives me the value: 13
Does that help? I know the code should work, in fact the other pages
that use this code are even in the same directory and are currently
working.
Tom
=====
var me = tom.pixelmech.webDeveloper();
http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
More information about the thelist
mailing list