I did search but too many results...
What my question is is how do I create a new file with php?
You enter the name of the file and what directory you want it to be saved in. I couldn't find anything here except fo a way to create a file with a .tmp file extension:
http://au2.php.net/manual/en/ref.filesystem.php
Thanks
Creating A New File With PHP?
Moderator: General Moderators
-
bionicdonkey
- Forum Contributor
- Posts: 132
- Joined: Fri Jan 31, 2003 2:28 am
- Location: Sydney, Australia
- Contact:
fopen() will create a file when used with w, w+, a, a+ parameter. e.g.
this will "Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it."
Code: Select all
<?
fopen("file.txt", "w");
?>http://au2.php.net/manual/en/function.fopen.php
Code: Select all
<?php
$newfile = fopen("data.txt", "a+");
fwrite($newfile, "This is a new file.");
fclose($newfile);
echo "All done";
?>