View Full Version : creating text files using php
itsonlybarney
12-30-2004, 03:16 AM
i've heard that you can create files on your server using php....wat is the function to do that and are there any special rules that need to be followed....
itsonlybarney
12-30-2004, 03:31 AM
i know how to add text to a text file as i just found out.....but can data be edited and how can u create the file??
buddie_coder
12-30-2004, 05:56 AM
You can open a file in 'x' or 'x+' mode to create a new file and write in it.
$handle = fopen("file.txt", "x");
This would fail if are trying to open an existing file.
Fou-Lu
12-30-2004, 10:06 AM
A standard w or w+ (b) should allow you to create the file as well, and won't give you an error if it already exists.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.