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?

Directory is created? Add to line 5 "or die('Cannot create directory')" eg
mkdir($dirname) or die ("Cannot create directory");
check web server error log file. Probably permission denied.