cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[NFR] Associative array for the result of the Request :: getUploadedFiles method

Open ekmst opened this issue 8 years ago • 1 comments

I suggest adding a second argument to the Phalcon\Http\Request::getUploadedFiles() method. If the parameter of the method true returns an associative array

Expected and Actual Behavior

class UploadController extends ControllerBase
{
    public function imageAction()
    {
        $files = $this->request->getUploadedFiles(true);
        print_r($files);
    }
}
//Array
//(
//    [0] => Phalcon\Http\Request\File Object
//        (
//            [_name:protected] => test.jpg
//            [_tmp:protected] => /tmp/phpc4o8Mq
//            [_size:protected] => 59949
//            [_type:protected] => image/jpeg
//            [_realType:protected] =>
//            [_error:protected] => 0
//            [_key:protected] => imageFieldKey
//            [_extension:protected] => jpg
//        )
//)

Result after passing the second argument

class UploadController extends ControllerBase
{
    public function imageAction()
    {
        $files = $this->request->getUploadedFiles(true, true);
        print_r($files);
    }
}
//Array
//(
//    [imageFieldKey] => Phalcon\Http\Request\File Object
//        (
//            [_name:protected] => test.jpg
//            [_tmp:protected] => /tmp/phpc4o8Mq
//            [_size:protected] => 59949
//            [_type:protected] => image/jpeg
//            [_realType:protected] =>
//            [_error:protected] => 0
//            [_key:protected] => imageFieldKey
//            [_extension:protected] => jpg
//        )
//)

ekmst avatar Nov 22 '18 18:11 ekmst

@ekmst Thank you

niden avatar Dec 25 '18 16:12 niden