protected function extractFileName($file)
{
if ($file instanceof UploadedFile) {
return $file->tempName;
} elseif (is_string($file)) {
if (file_exists($file)) {
return $file;
} else {
throw new InvalidParamException("File '{$file}' does not exist.");
}
} else {
throw new InvalidParamException('Unsupported type of "file" attribute.');
}
}