else { $max_dimensions = 0;
} $validators =
[ 'file_validate_extensions' =>
['gif png jpg jpeg'
],
'file_validate_size' =>
[$max_filesize],
'file_validate_image_resolution' =>
[$max_dimensions],
];
$prepared_filename =
$this->
prepareFilename($filename,
$validators);
// Create the file.
$file_uri = "{
$destination}/{
$prepared_filename}";
// Using the UploadedFile method instead of streamUploadData.
$temp_file_path =
$upload->
getRealPath();
$file_uri =
$this->fileSystem->
getDestinationFilename($file_uri, FileSystemInterface::EXISTS_RENAME
);
// Lock based on the prepared file URI.
$lock_id =
$this->
generateLockIdFromFileUri($file_uri);