How can I receive data from POST request in my controller? I don't use twig.
public function newAction(Request $request)
{
//when I use
$content = $request->getContent();
// as result I see "string" with need field and value. It's 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) Post data to object or array
I send request using Postman with header "Content-Type: application/json".
And can you show me how to save file(image)?
$request->request->get('content');
POST:
$request->request->get('<propertyName>');
GET:
$request->query->get('<propertyName>');
Dump all data from request to find possible problem with:
$request->request->all();
You can use for POST request :
For GET request:
For FILE queries:
And ask your questions
How to save image?
, you must createuploads -> excels
: