MediaManager.php
public function prepare(MediaInterface $media, UploadedFile $fileInfo)
    {
        // ensure the rootDir exists
        $uploadDir = $this->getUploadRootDir();

        $fs = new Filesystem();
        if( !$fs->exists($uploadDir) ) {
            $fs->mkdir($uploadDir, 0775);
        }

        $media->setName($fileInfo->getClientOriginalName());
        // Call the name generation strategy
        $path = $this->nameGenerationStrategy->generateName($media, $fileInfo);
        $media->setPath($path);
        $media->setWebPath(join(DIRECTORY_SEPARATOR, array($this->getUploadDir(),$path)));
        $media->setAbsolutePath($this->getAbsolutePath($path));
    }
public function prepare(MediaInterface $media, UploadedFile $fileInfo)
    {
        // ensure the rootDir exists
        $uploadDir = $this->getUploadRootDir();

        $fs = new Filesystem();
        if( !$fs->exists($uploadDir) ) {
            $fs->mkdir($uploadDir, 0775);
        }

        $media->setName($fileInfo->getClientOriginalName());
        // Call the name generation strategy
        $path = $this->nameGenerationStrategy->generateName($media, $fileInfo);
        $media->setPath($path);
        $media->setWebPath(join(DIRECTORY_SEPARATOR, array($this->getUploadDir(),$path)));
        $media->setAbsolutePath($this->getAbsolutePath($path));
    }
public function prepare ( MediaInterface $ media , UploadedFile $ fileInfo ) { // ensure the rootDir exists $ uploadDir = $ this -> getUploadRootDir ( ) ; $ fs = new Filesystem ( ) ; if ( ! $ fs -> exists ( $ uploadDir ) ) { $ fs -> mkdir ( $ uploadDir , 0775 ) ; } $ media -> setName ( $ fileInfo -> getClientOriginalName ( ) ) ; // Call the name generation strategy $ path = $ this -> nameGenerationStrategy -> generateName ( $ media , $ fileInfo ) ; $ media -> setPath ( $ path ) ; $ media -> setWebPath ( join ( DIRECTORY_SEPARATOR , array ( $ this -> getUploadDir ( ) , $ path ) ) ) ; $ media -> setAbsolutePath ( $ this -> getAbsolutePath ( $ path ) ) ; }
{@inheritdoc}
{