src/Request/SlimRequest.php
/**
     * Checks parts headers, and parses data in it
     *
     * @param string $bodyPart         Split part from body
     * @param array  $filePartialsInfo Data with current uploaded files
     *
     * @return void
     */
Checks parts headers, and parses data in it
@param string $bodyPart         Split part from body
@param array  $filePartialsInfo Data with current uploaded files

@return void
Checks parts headers and parses data in it @param string $bodyPart Split part from body @param array $filePartialsInfo Data with current uploaded files @return void
static function parseBodyParts(string $bodyPart, array &$filePartialsInfo)
    {
        preg_match('/^'.static::CONTENTDISPOSITION.' (.*);/', $bodyPart, $contentDispo);
        if (count($contentDispo) > 0) {
            preg_match('/filename="(.*)"/', $bodyPart, $filename);
            if(isset($filename[1]) === true) {
                preg_match('/\r\nContent-Type: (.*)/', $bodyPart, $contentType);
                preg_match('/name=\"(.*)\";/', $bodyPart, $name);
                $temp_file = static::getTmpFile($bodyPart);
                static::writeFilesArray($filePartialsInfo, $name, $filename, $contentType, $temp_file);
            } else {
                preg_match('/name=\"(.*)\"/', $bodyPart, $name);
                $index = $name[1];
                $initPos = strpos($bodyPart, "\r\n\r\n");
                $filePartialsInfo['fields'][$index] = substr($bodyPart, $initPos+4);
                $filePartialsInfo['fields'][$index] = substr($filePartialsInfo['fields'][$index], 0, -2);
            }
        } else {
            if ($filePartialsInfo['last']['type'] === 'files') {
                static::writeToTmpFile(
                    $bodyPart,
                    $filePartialsInfo[$filePartialsInfo['last']['type']][$filePartialsInfo['last']['index']]['tmp_name']
                );
            }
        }
    }
static function parseBodyParts ( string $ bodyPart , array & $ filePartialsInfo ) { preg_match ( '/^' . static :: CONTENTDISPOSITION . ' (.*);/' , $ bodyPart , $ contentDispo ) ; if ( count ( $ contentDispo ) > 0 ) { preg_match ( '/filename="(.*)"/' , $ bodyPart , $ filename ) ; if ( isset ( $ filename [ 1 ] ) === true ) { preg_match ( '/\r\nContent-Type: (.*)/' , $ bodyPart , $ contentType ) ; preg_match ( '/name=\"(.*)\";/' , $ bodyPart , $ name ) ; $ temp_file = static :: getTmpFile ( $ bodyPart ) ; static :: writeFilesArray ( $ filePartialsInfo , $ name , $ filename , $ contentType , $ temp_file ) ; } else { preg_match ( '/name=\"(.*)\"/' , $ bodyPart , $ name ) ; $ index = $ name [ 1 ] ; $ initPos = strpos ( $ bodyPart , " \r \n \r \n " ) ; $ filePartialsInfo [ 'fields' ] [ $ index ] = substr ( $ bodyPart , $ initPos + 4 ) ; $ filePartialsInfo [ 'fields' ] [ $ index ] = substr ( $ filePartialsInfo [ 'fields' ] [ $ index ] , 0 , - 2 ) ; } } else { if ( $ filePartialsInfo [ 'last' ] [ 'type' ] === 'files' ) { static :: writeToTmpFile ( $ bodyPart , $ filePartialsInfo [ $ filePartialsInfo [ 'last' ] [ 'type' ] ] [ $ filePartialsInfo [ 'last' ] [ 'index' ] ] [ 'tmp_name' ] ) ; } } }
Checks parts headers, and parses data in it
 @param string $bodyPart         Split part from body
 @param array  $filePartialsInfo Data with current uploaded files
Checks parts headers and parses data in it @param string $bodyPart Split part from body @param array $filePartialsInfo Data with current uploaded files