We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

FormData in Phalcon ?

I am sending FormData with files and json through angular. How to deal it with phalcon ?

Got it working - just had to send it that way with angular :

headers: {'Content-Type': undefined}, transformRequest: angular.identity

and data as my formData and i see uploadedFiles and as well as json :)



17.5k

I have dealt with it a different way... In my base controller I have a getRequest() function that returns the post data from angular:

    public function getRequest() {
        return json_decode(file_get_contents("php://input"));
    }

This is something I also dealt with when building a Yii application last year. Good to know about the header solution too!