I've been trying to store a binary file in my database using a controller. I have an entity with a blob field. How can I read the uploaded file, get its binary data and store it in my blob field?
So far I have this code:
public function postPictureAction($slug, Request $request)
{
return $request->files;
}
And I get back this:
{
"parameters": {
"picture": {
"test": false,
"original_name": "Untitled Diagram.png",
"mime_type": "image/png",
"size": 13423,
"error": 0
}
},
"file_keys": [
"error",
"name",
"size",
"tmp_name",
"type"
]
}
So the file seems to be uploaded just fine, but now, where is it? how can I read it?
This code returns the file's mime type:
$picture->setType($file->getMimeType());
But this is just intuition, since I didn't find any documentation on the "file" class. Is there such documentation?