Give 777 permission to dynamically created file in php
Give permission in to dynamically created file
$upPath = yourpath;
if(!file_exists($upPath))
{
$oldmask = umask(0);
mkdir($upPath, 0777, true);
umask($oldmask);
}
Use the function chmod
chmod
$fp = fopen($file, 'w');
fwrite($fp, $content);
fclose($fp);
chmod($file, 0777);
Use chmod()
to set file permissions.
use:
private function writeFileContent($file, $content){
$fp = fopen($file, 'w');
fwrite($fp, $content);
fclose($fp);
chmod($file, 0777); //changed to add the zero
return true;
}