How can I get data from a POST request in my controller? I do not use a branch.
public function newAction(Request $request) { //when I use $content = $request->getContent(); // as result I see "string" with need field and value. It not json // array // value like /* string '------WebKitFormBoundaryI12ukQBs3HdmPjvh Content-Disposition: form-data; name="title" "valuefortitle" ------WebKitFormBoundaryI12ukQBs3HdmPjvh Content-Disposition: form-data; name="name" "supername" ------WebKitFormBoundaryI12ukQBs3HdmPjvh-- ' (length=253) */ }
Or how can I serialize (convert) Publish data to an object or array
I am sending a request using Postman with the heading "Content-Type: application / json".
And can you show me how to save the file (image)?
json post php symfony save
A6Brgeuka
source share