public function initializeMediaFromUploadedFile(UploadedFile $uploadedFile, $folderId, $siteId, $title = null)
    {
        /** @var MediaInterface $media */
        $media = new $this->mediaClass();
        $media->setSiteId($siteId);
        $media->setFile($uploadedFile);
        $media->setFilesystemName($uploadedFile->getFilename());
        $media->setMediaFolder($this->folderRepository->find($folderId));
        $media->setName($uploadedFile->getClientOriginalName());
        $media->setMimeType($uploadedFile->getMimeType());
        if (null === $title) {
            $title = $uploadedFile->getFilename();
        }
        foreach ($this->frontLanguages as $language) {
            $media->addTitle($language, $title);
        }

        return $media;
    }
public function initializeMediaFromUploadedFile(UploadedFile $uploadedFile, $folderId, $siteId, $title = null)
    {
        /** @var MediaInterface $media */
        $media = new $this->mediaClass();
        $media->setSiteId($siteId);
        $media->setFile($uploadedFile);
        $media->setFilesystemName($uploadedFile->getFilename());
        $media->setMediaFolder($this->folderRepository->find($folderId));
        $media->setName($uploadedFile->getClientOriginalName());
        $media->setMimeType($uploadedFile->getMimeType());
        if (null === $title) {
            $title = $uploadedFile->getFilename();
        }
        foreach ($this->frontLanguages as $language) {
            $media->addTitle($language, $title);
        }

        return $media;
    }
public function initializeMediaFromUploadedFile ( UploadedFile $ uploadedFile , $ folderId , $ siteId , $ title = null ) { /** @var MediaInterface $media */ $ media = new $ this -> mediaClass ( ) ; $ media -> setSiteId ( $ siteId ) ; $ media -> setFile ( $ uploadedFile ) ; $ media -> setFilesystemName ( $ uploadedFile -> getFilename ( ) ) ; $ media -> setMediaFolder ( $ this -> folderRepository -> find ( $ folderId ) ) ; $ media -> setName ( $ uploadedFile -> getClientOriginalName ( ) ) ; $ media -> setMimeType ( $ uploadedFile -> getMimeType ( ) ) ; if ( null === $ title ) { $ title = $ uploadedFile -> getFilename ( ) ; } foreach ( $ this -> frontLanguages as $ language ) { $ media -> addTitle ( $ language , $ title ) ; } return $ media ; }
initialize a media to fit an uploaded file

@param UploadedFile $uploadedFile
@param string       $folderId
@param string       $siteId
@param string|null  $title

@return MediaInterface
initialize a media to fit an uploaded file