title: How to retrieve an uploaded file from an HTML form
body: <p>I have an HTML form, which can contain an infinite number of file inputs, declared like so in a twig template:</p>
  <pre><code>&lt;form action=&quot;my_route&quot;&gt;
      {% for file in files %}
          &lt;label&gt;Current file: {{ file.name }}&lt;/label&gt;&lt;br&gt;
          &lt;label&gt;File to replace (optional): &lt;/label&gt;
          &lt;input name=&quot;{{ file.id }}&quot; type=&quot;file&quot;&gt;&lt;br&gt;
      {% endfor %}
      &lt;button type=&quot;submit&quot;&gt;Send&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  <p>The aim of this form is to let user change the files generated by the server, with new files.</p>
  <p>My question is, <strong>how can i retrieve the sent files</strong>, inside my controller ?</p>
  <p>I have already tried to retrieve the files from the <code>request</code> object, like so:
  <code>$request-&gt;get(&quot;the_id&quot;);</code> But, it only gives me the file name as a string, not as a file.</p>
  <p>Please note that if rendering the form using Symfony functions (<code>createForm</code>, <code>renderForm</code>, ...) make the task easier, I can use them; I've just not yet found a way to use them in this case.</p>