Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
stripEmptyFiles example
$form
->
addError
(
new
FormError
(
$form
->
getConfig
(
)
->
getOption
(
'upload_max_size_message'
)
(
)
,
null,
[
'{{ max }}' =>
$this
->serverParams->
getNormalizedIniPostMaxSize
(
)
]
)
)
;
return
;
}
$fixedFiles
=
[
]
;
foreach
(
$_FILES
as
$fileKey
=>
$file
)
{
$fixedFiles
[
$fileKey
]
= self::
stripEmptyFiles
(
self::
fixPhpFilesArray
(
$file
)
)
;
}
if
(
'' ===
$name
)
{
$params
=
$_POST
;
$files
=
$fixedFiles
;
}
elseif
(
\
array_key_exists
(
$name
,
$_POST
)
|| \
array_key_exists
(
$name
,
$fixedFiles
)
)
{
$default
=
$form
->
getConfig
(
)
->
getCompound
(
)
?
[
]
: null;
$params
= \
array_key_exists
(
$name
,
$_POST
)
?
$_POST
[
$name
]
:
$default
;
$files
= \
array_key_exists
(
$name
,
$fixedFiles
)
?
$fixedFiles
[
$name
]
:
$default
;
}
else
{
// Don't submit the form if it is not present in the request