Hello guys I'm trying to read a file copy content into a new file to a random directory:
<?php
error_reporting(E_ALL);
$dirname = uniqid();
mkdir($dirname);
$newFileName = '/'.$dirname.'/newfile.txt';
$newFileContent = 'someinfoinfile.txt';
if (file_put_contents($newFileName, $newFileContent) !== false) {
echo "File created (" . basename($newFileName) . ")";
} else {
echo "Cannot create file (" . basename($newFileName) . ")";
}
?>
and got a no file or directory error.. Where I'm wrong?