
December 23rd, 2004
11:31 AM
Creating a file
Hey, I was wondering if anyone could help me out, I want to be able to put text in, and a file name in, and have a script create the file for me, I was wondering if anyone can help me out, thanks!
___________________
[b][Static Shock][/b]
[img]http://phplab.shockonline.com/ss/sssig.gif[/img]
Currently working on [b]PHP Lab[/b], Offering PHP and HTML tutorials as well as free PHP scripts.

December 23rd, 2004
11:59 AM
for creating empty files, you can try
<?php
touch ( '/path/to/file.txt' );
?>
if you want to create a new file then write to it after, use fopen
http://us2.php.net/manual/en/function.fopen.php
___________________
http://celerondude.com

December 23rd, 2004
12:14 PM
Awesome man, thanks a bunch 
___________________
[b][Static Shock][/b]
[img]http://phplab.shockonline.com/ss/sssig.gif[/img]
Currently working on [b]PHP Lab[/b], Offering PHP and HTML tutorials as well as free PHP scripts.

December 23rd, 2004
12:38 PM
Is there anyway I can set the properties for the file? Because after it gets created, I have to manually chmod it so that I can edit it.
___________________
[b][Static Shock][/b]
[img]http://phplab.shockonline.com/ss/sssig.gif[/img]
Currently working on [b]PHP Lab[/b], Offering PHP and HTML tutorials as well as free PHP scripts.

December 23rd, 2004
01:04 PM
Neverside Newbie
Status: Offline!
i usually use fopen with "w" and fputs into the file and it is ok...
if u want to change the mode, i think u can use
chmod("/usr/fullpath", 0666)

December 23rd, 2004
01:29 PM
thinking of something witty to put here
Status: Offline!

December 24th, 2004
08:38 AM
Neversidian
Status: Offline!
fopen('radley');
___________________
Neverside Development Director
PHP Snippets
BigToach.com - IT WORKS, TOACHY!