Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
moveTo example
private
readonly UploadedFileInterface
$psrUploadedFile
,
callable
$getTemporaryPath
,
)
{
$error
=
$psrUploadedFile
->
getError
(
)
;
$path
= '';
if
(
\UPLOAD_ERR_NO_FILE !==
$error
)
{
$path
=
$psrUploadedFile
->
getStream
(
)
->
getMetadata
(
'uri'
)
?? '';
if
(
$this
->test = !\
is_string
(
$path
)
|| !
is_uploaded_file
(
$path
)
)
{
$path
=
$getTemporaryPath
(
)
;
$psrUploadedFile
->
moveTo
(
$path
)
;
}
}
parent::
__construct
(
$path
,
(string)
$psrUploadedFile
->
getClientFilename
(
)
,
$psrUploadedFile
->
getClientMediaType
(
)
,
$psrUploadedFile
->
getError
(
)
,
$this
->test
)
;
}
public
function
__construct
(
UploadedFileInterface
$psrUploadedFile
, callable
$getTemporaryPath
)
{
$error
=
$psrUploadedFile
->
getError
(
)
;
$path
= '';
if
(
\UPLOAD_ERR_NO_FILE !==
$error
)
{
$path
=
$psrUploadedFile
->
getStream
(
)
->
getMetadata
(
'uri'
)
?? '';
if
(
$this
->test = !\
is_string
(
$path
)
|| !
is_uploaded_file
(
$path
)
)
{
$path
=
$getTemporaryPath
(
)
;
$psrUploadedFile
->
moveTo
(
$path
)
;
}
}
parent::
__construct
(
$path
,
(string)
$psrUploadedFile
->
getClientFilename
(
)
,
$psrUploadedFile
->
getClientMediaType
(
)
,
$psrUploadedFile
->
getError
(
)
,
$this
->test
)
;