Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
openSourceFromUrl example
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
{
$writtenBytes
=
$this
->
copyStreams
(
$inputStream
,
$destStream
,
$this
->maxFileSize
)
;
}
finally
{
fclose
(
$inputStream
)
;
fclose
(
$destStream
)
;
}
return
new
MediaFile
(
$fileName
,