Originally posted by SDP2006 Well, fopen wouldn't seem to create, but thanks anyways
Are you blind or just South Carolinian?
Quote:
'x' Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files. 'x+' Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. This option is supported in PHP 4.3.2 and later, and only works for local files.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Is PHP 4.3.2 installed on your host? That's needed as a minimum requirement if you want to use the 'x' flags. Why don't you go with the standard 'w' argument?
Quote:
Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
__________________
De gustibus non est disputandum.
Yes, I have 4.2.3 on my server. I changed it to "w". Now it is creating the file, but nothing is being written to the file. I still get one error, which I think is the reason the file is not being written -
Warning: fwrite(): supplied argument is not a valid File-Handle resource in /usr/local/psa/home/vhosts/net-riches.com/httpdocs/includes/fcreate/filecreater.php on line 7
Assuming you use a similar code as shown above, you need to pass the file handle as an argument to frwrite(), not the file name itself. Basically this example illustrates the usage:
Wonderful guys! It creates and writes to the file now. Step 1 complete. Now, when I acess the file I created, example http://www.net-riches.com/includes/fcreate/testone.php i get the errors as you can see. I typed in testone.php for the file name and
PHP Code:
<?php
echo "TEST";
?>
for the file contents. It is adding slashes to the " "'s. How do I stop it from doing that?
__________________ Stevie Peele Neverside IRC Network - irc.veonex.net | tc.tutorialnetwork.org #dev - any programming,etc. question #design - design discussion and critque #central - general chat Come join us!