if (!
$file->
isValid()) { throw new Exception('The file exceeds the max file size.'
);
} } catch (Exception
$e) { $this->
View()->
assign(['success' => false, 'message' =>
$e->
getMessage()]);
return;
} // Create a new model and set the properties
$media =
new Media();
$albumId = !
empty($params['albumID'
]) ?
$params['albumID'
] : self::UNSORTED_ALBUM_ID;
/** @var Album|null $album */
$album =
$this->
get('models'
)->
find(Album::
class,
$albumId);
if (!
$album) { $this->
View()->
assign(['success' => false, 'message' => 'Invalid album id passed'
]);
return;
}