Jump to content

How to make PHP create a file only if it doesn't exist


Username:

Recommended Posts

Check for its existence, file_exists.

 

And how can I make it so if it does already exist, it doesn't over-write information already in it?

 

Switching to mode 'a' will create the file if it doesn't exist and append to it if it does. Assuming your using fopen.

Check for its existence, file_exists.

 

And how can I make it so if it does already exist, it doesn't over-write information already in it?

 

Switching to mode 'a' will create the file if it doesn't exist and append to it if it does. Assuming your using fopen.

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.