Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getUrlFromRequest example
$bytesWritten
,
hash_file
(
'md5',
$fileName
)
?: null
)
;
}
public
function
fetchFileFromURL
(
Request
$request
, string
$fileName
)
: MediaFile
{
if
(
!
$this
->enableUrlUploadFeature
)
{
throw
MediaException::
disableUrlUploadFeature
(
)
;
}
$url
=
$this
->
getUrlFromRequest
(
$request
)
;
if
(
$this
->enableUrlValidation && !
$this
->fileUrlValidator->
isValid
(
$url
)
)
{
throw
MediaException::
illegalUrl
(
$url
)
;
}
$extension
=
$this
->
getExtensionFromRequest
(
$request
)
;
$inputStream
=
$this
->
openSourceFromUrl
(
$url
)
;
$destStream
=
$this
->
openDestinationStream
(
$fileName
)
;
try
{