Why is the server not created the directory?

Hello. I have the following problem.
Here locally, this function works without problems:
public function upload($file)
{
 if (strpos($file->type, "image") !== false)
{
 $this->type = self::TYPE_IMAGE;

 $out_dir = '/uploads/images/'.substr(md5(time()), 0, 2).'/'.substr(md5(time()+1), 0, 2).'/';
}
else
{
 $this->type = self::TYPE_OTHER;

 $out_dir = '/uploads/files/'.substr(md5(time()), 0, 2).'/'.substr(md5(time()+1), 0, 2).'/';
}

 $out_file_name = md5(time()+2) . '.' . $file->extension;
 $out_file = $out_dir . $out_file_name;

 BaseFileHelper::createDirectory(Yii::getAlias("@webroot") . $out_dir);

 if ($file->saveAs(Yii::getAlias("@webroot") . $out_file))
{
 $this->dir = $out_dir;
 $this->file_name = $out_file_name;
 $this->original_file_name = $file->baseName . '.' . $file->extension;

 return true;
}
else
 return false;
 }

On the server, this function cannot even create a directory.
Line
BaseFileHelper::createDirectory(Yii::getAlias("@webroot") . $out_dir);

Returns false. Checked the paths, everything is correct. Can't understand what the problem is.
Please tell me. Thanks in advance to all responded.
March 12th 20 at 08:10
1 answer
March 12th 20 at 08:12
Solution
write asked?


the solution in the comments of the question

Find more questions by tags Yii