• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

creating a file in php

keith

anti-liberal
NLC
ok, i'm stupid. looked all over php.net.

i know how to open files, write to them, and delete them. but how would i check if a file exists, and if not create it?

say i need to write to keith.txt, a file that doesn't exist yet. well before i can write to it, it must be created. what would i have to enter for it to be created?
 
Just start writing to it. As long as the script is allowed to write in the directory you want the file in, it'll automatically create it. To check if a file exists, use file_exists.
 
haha, yeah, figured it out a few minutes after posting the message. like i said: stupid. thanks for the response though.
 
Back
Top