PHP 클래스 yii\web\MultipartFormDataParser

This parser provides the fallback for the 'multipart/form-data' processing on non POST requests, for example: the one with 'PUT' request method. In order to enable this parser you should configure [[Request::parsers]] in the following way: php return [ 'components' => [ 'request' => [ 'parsers' => [ 'multipart/form-data' => 'yii\web\MultipartFormDataParser' ], ], ... ], ... ]; Method MultipartFormDataParser::parse of this parser automatically populates $_FILES with the files parsed from raw body. > Note: since this is a request parser, it will initialize $_FILES values on [[Request::getBodyParams()]]. Until this method is invoked, $_FILES array will remain empty even if there are submitted files in the request body. Make sure you have requested body params before any attempt to get uploaded file in case you are using this parser. Usage example: php use yii\web\UploadedFile; $restRequestData = Yii::$app->request->getBodyParams(); $uploadedFile = UploadedFile::getInstancesByName('photo'); $model = new Item(); $model->populate($restRequestData); copy($uploadedFile->tempName, '/path/to/file/storage/photo.jpg'); > Note: although this parser fully emulates regular structure of the $_FILES, related temporary files, which are available via tmp_name key, will not be recognized by PHP as uploaded ones. Thus functions like is_uploaded_file() and move_uploaded_file() will fail on them. This also means [[UploadedFile::saveAs()]] will fail as well.
부터: 2.0.10
저자: Paul Klimov ([email protected])
상속: extends yii\base\Object, implements yii\web\RequestParserInterface
파일 보기 프로젝트 열기: yiisoft/yii2

공개 메소드들

메소드 설명
getUploadFileMaxCount ( ) : integer
getUploadFileMaxSize ( ) : integer
parse ( $rawBody, $contentType )
setUploadFileMaxCount ( integer $uploadFileMaxCount )
setUploadFileMaxSize ( integer $uploadFileMaxSize )

비공개 메소드들

메소드 설명
addFile ( array &$files, string $name, array $info ) Adds file info to the uploaded files array by input name, e.g. Item[file].
addValue ( array &$array, string $name, mixed $value ) Adds value to the array by input name, e.g. Item[name].
getByteSize ( string $verboseSize ) : integer Gets the size in bytes from verbose size representation.
parseHeaders ( string $headerContent ) : array Parses content part headers.

메소드 상세

getUploadFileMaxCount() 공개 메소드

public getUploadFileMaxCount ( ) : integer
리턴 integer maximum upload files count.

getUploadFileMaxSize() 공개 메소드

public getUploadFileMaxSize ( ) : integer
리턴 integer upload file max size in bytes.

parse() 공개 메소드

public parse ( $rawBody, $contentType )

setUploadFileMaxCount() 공개 메소드

public setUploadFileMaxCount ( integer $uploadFileMaxCount )
$uploadFileMaxCount integer maximum upload files count.

setUploadFileMaxSize() 공개 메소드

public setUploadFileMaxSize ( integer $uploadFileMaxSize )
$uploadFileMaxSize integer upload file max size in bytes.