PHP –– create a file
written by: admin
Date Written: 3/13/10
Last Updated: 11/3/19
This simple little script will create a file. x+ means you can open the file, write to it and edit it. If the file does not exist it will attempt to create it and if the file does exist an error message will be displayed. For example in this script the file
upload.php is
created in the directory that the script is running in.
fopen()
<?php
$handle = fopen("upload.php", "a+");
?>
a+ will open a file for reading and writing. If the file does not exist it will attempt to create it.
TAGS: php,
flatfile