// Assert that the destination contains a valid stream.
$destinationScheme = $this->streamWrapperManager::getScheme($destination); if(!$this->streamWrapperManager->isValidScheme($destinationScheme)){ thrownewInvalidStreamWrapperException(sprintf('The file could not be uploaded because the destination "%s" is invalid.', $destination)); }
// A file URI may already have a trailing slash or look like "public://".
if(substr($destination, -1) != '/'){ $destination .= '/'; }