/**
* @param FileUpload $file
* @return string
*/
public function save(FileUpload $file)
{
do {
$filename = Strings::random(5) . '-' . $file->getSanitizedName();
$targetFile = $this->getAbsolutePath() . '/' . $filename;
} while (file_exists($targetFile));
$image = $file->toImage();
$image->save($targetFile);
return $filename;
}