I'm trying to do an image upload using a Symfony REST API.
However, I'm having problems trying to read the POST request file parameter on Symfony's side using Postman.
On Postman I have the following body on the POST request:
form-data POST request with key=file
and value=some image
When the Request reaches Symfony, I have the following:
public function uploadImage(Request $request)
{
$params = $request->request;
$file = $params->get('image');
dump($file);
...
}
The file
variable is null
. I have also tried using $params = $request->files
but the result is the same.
If I dump $request->getContent()
I can see the file is passing through, but cannot have access to it to do what I need.
Am I missing something?