My issue isn't that the folder is getting written, it's the permissions that it's being written with. Here is the code I'm using the write the file:
// check if the file/folder exists
$targetPath = 'files/docmoga/';
if(!file_exists($targetPath)){
$oldmask = umask(0);
mkdir($targetPath, '0777', true);
umask($oldmask);
}
move_uploaded_file($tempFile, $targetFile);
It's failing on the last line because of permissions. Here are the permissions the folder is being written with:
dr----x--t 2 apache apache 4096 May 4 09:17 docmoga
What might be happening to cause the permissions to being written incorrectly for that folder? If it helps I'm using laravel as a framework which I know shouldn't mean anything.