title: Symfony2 controller store file in database
body: <p>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?</p>
  
  <p>So far I have this code:</p>
  
  <pre><code>  public function postPictureAction($slug, Request $request)
    {
      return $request-&gt;files;
    }
  </code></pre>
  
  <p>And I get back this:</p>
  
  <pre><code>  { 
  
     "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"
      ]
  }
  </code></pre>
  
  <p>So the file seems to be uploaded just fine, but now, where is it? how can I read it?</p>
  
  <p>This code returns the file's mime type:</p>
  
  <pre><code>$picture-&gt;setType($file-&gt;getMimeType());
  </code></pre>
  
  <p>But this is just intuition, since I didn't find any documentation on the "file" class. Is there such documentation?</p>