|
|
|
@ -511,7 +511,7 @@ class Request
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$fileArray = [];
|
|
|
|
$fileArray = [];
|
|
|
|
foreach ($filesCollection as $fileKeyName => $file) {
|
|
|
|
foreach ($filesCollection as $fileKeyName => $file) {
|
|
|
|
$isMulti = is_array($file['name']) === true ;
|
|
|
|
$isMulti = is_array($file['name']) === true;
|
|
|
|
$fileCount = $isMulti === true ? count($file['name']) : 1;
|
|
|
|
$fileCount = $isMulti === true ? count($file['name']) : 1;
|
|
|
|
$fileKeys = array_keys($file);
|
|
|
|
$fileKeys = array_keys($file);
|
|
|
|
|
|
|
|
|
|
|
|
@ -533,7 +533,8 @@ class Request
|
|
|
|
* Parse request body data for HTTP methods that don't natively support form data (PUT, DELETE, PATCH)
|
|
|
|
* Parse request body data for HTTP methods that don't natively support form data (PUT, DELETE, PATCH)
|
|
|
|
* @return void
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected function parseRequestBodyForHttpMethods(): void {
|
|
|
|
protected function parseRequestBodyForHttpMethods(): void
|
|
|
|
|
|
|
|
{
|
|
|
|
$body = $this->getBody();
|
|
|
|
$body = $this->getBody();
|
|
|
|
|
|
|
|
|
|
|
|
// Empty body
|
|
|
|
// Empty body
|
|
|
|
@ -571,7 +572,7 @@ class Request
|
|
|
|
|
|
|
|
|
|
|
|
// Parse multipart/form-data
|
|
|
|
// Parse multipart/form-data
|
|
|
|
$bodyParts = preg_split('/\\R?-+' . preg_quote($boundary, '/') . '/s', $body);
|
|
|
|
$bodyParts = preg_split('/\\R?-+' . preg_quote($boundary, '/') . '/s', $body);
|
|
|
|
array_pop($bodyParts); // Remove last element (empty)
|
|
|
|
array_pop($bodyParts); // Remove last element (empty)
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($bodyParts as $bodyPart) {
|
|
|
|
foreach ($bodyParts as $bodyPart) {
|
|
|
|
if (empty($bodyPart)) {
|
|
|
|
if (empty($bodyPart)) {
|
|
|
|
@ -700,7 +701,7 @@ class Request
|
|
|
|
* Get the maximum file size that can be uploaded.
|
|
|
|
* Get the maximum file size that can be uploaded.
|
|
|
|
* @return int The maximum file size in bytes.
|
|
|
|
* @return int The maximum file size in bytes.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected function getUploadMaxFileSize() {
|
|
|
|
protected function getUploadMaxFileSize(): int {
|
|
|
|
$value = ini_get('upload_max_filesize');
|
|
|
|
$value = ini_get('upload_max_filesize');
|
|
|
|
|
|
|
|
|
|
|
|
$unit = strtolower(preg_replace('/[^a-zA-Z]/', '', $value));
|
|
|
|
$unit = strtolower(preg_replace('/[^a-zA-Z]/', '', $value));
|
|
|
|
@ -723,7 +724,7 @@ class Request
|
|
|
|
case 'kb':
|
|
|
|
case 'kb':
|
|
|
|
$value *= 1024;
|
|
|
|
$value *= 1024;
|
|
|
|
case 'b': // Byte
|
|
|
|
case 'b': // Byte
|
|
|
|
return $value *= 1;
|
|
|
|
return (int)$value;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|