file_put_contents() not functioning correctly
Posted 02 December 2007 - 02:50 PM
Although I am having a small problem with file_put_contents(). I have created a php page that generates a web site from a xml file... when I ran the script it all went ok, the files were created and could be viewed via localhost. But when I looked in the 'www' folder they didn't exsist.
I finally found the files in "C:\Users\Darkr\AppData\Local\VirtualStore\Program Files\Uniform Server\udrive\www"
So I have solved the problem, but I would prefer if the files went to uniform server's virtual drive or the install directory. Is this possible?
Posted 02 December 2007 - 05:49 PM
The command will write a file relative to the folder where the script is run.
For example if you put this into www name it test1.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Test</title> </head> <body> <h1>Test</h1> <p>Echo will display number of characters in the string "33"</p> <?php echo file_put_contents("test.txt","Pick this file up in www. Testing"); ?> </body> </html>
It will create file test.txt in www
The only conflict is if you have a file name that is identical to one on the include path.
It could be the script that is setting that path!
All the best
Posted 02 December 2007 - 10:05 PM
I was going to do your example to make sure it wasnt a path problem, when I got to saving the file in Notepad++ i could see the files, but I cannot see the files when going through file manager. I also noticed a 'compatibility files' button on file manager, once clicked it takes me to the folder mentioned previously.
So i guess its time to read up on vistas features :/
Thanx for your quick reply
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users