Jump to content

[SOLVED] Create a non Existing file..


mikelmao

Recommended Posts

Using fopen().

 

<?php

$filename = "newfile.txt";

if(file_exists($filename))
echo "Already exists";
else
{
$h = fopen($filename, "w+");
echo $filename." created!";
}

?>

 

 

If what you're looking for is a way to create a file with an unique name you can use tempnam().

 

Orio.

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.