src/Storage/File/StorableFileFactory.php
public function makeFromUrl($url, $name = null, $mimeType = null)
    {
        try {
            $localPath = $this->downloader->download($url);

        } catch (Exception $e) {

            throw new CouldNotRetrieveRemoteFileException(
                "Could not retrieve file from '{$url}'",
                $e->getcode(),
                $e
            );
        }

        if (null === $name) {
            $name = $this->getBaseNameFromUrl($url);
        }

        // Always flag as uploaded, since we downloaded to a local path
        return $this->uploaded()->makeFromLocalPath($localPath, $name, $mimeType);
    }
public function makeFromUrl($url, $name = null, $mimeType = null)
    {
        try {
            $localPath = $this->downloader->download($url);

        } catch (Exception $e) {

            throw new CouldNotRetrieveRemoteFileException(
                "Could not retrieve file from '{$url}'",
                $e->getcode(),
                $e
            );
        }

        if (null === $name) {
            $name = $this->getBaseNameFromUrl($url);
        }

        // Always flag as uploaded, since we downloaded to a local path
        return $this->uploaded()->makeFromLocalPath($localPath, $name, $mimeType);
    }
public function makeFromUrl ( $ url , $ name = null , $ mimeType = null ) { try { $ localPath = $ this -> downloader -> download ( $ url ) ; } catch ( Exception $ e ) { throw new CouldNotRetrieveRemoteFileException ( "Could not retrieve file from '{$url}'" , $ e -> getcode ( ) , $ e ) ; } if ( null === $ name ) { $ name = $ this -> getBaseNameFromUrl ( $ url ) ; } // Always flag as uploaded, since we downloaded to a local path return $ this -> uploaded ( ) -> makeFromLocalPath ( $ localPath , $ name , $ mimeType ) ; }
Makes a normalized storable file instance from a URI.

@param string      $url
@param string|null $name
@param string|null $mimeType
@return StorableFileInterface
@throws CouldNotRetrieveRemoteFileException
Makes a normalized storable file instance from a URI .