title: Reusing Symfony2 Forms Type for Update and Creation with Uploaded File
body: <p>I have a form type that I use for making a reusable form for uploading a file. It's integrated with Gaufrette and Amazon S3, and works like a charm. I wanted to reuse the same form type for editing / updating.</p>
  
  <p>I created the routing, callback, etc. for the edit. When I reuse the same form type, it breaks on the mapping:</p>
  
  <blockquote>
    <p>The form's view data is expected to be an instance of class Symfony\Component\HttpFoundation\File\File, but is a(n) string. You can avoid this error by setting the "data_class" option to null or by adding a view transformer that transforms a(n) string to an instance of Symfony\Component\HttpFoundation\File\File. </p>
  </blockquote>
  
  <p>When I set mapped to false, the form works for update, but doesn't work for the initial creation.</p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options)
  {
      $builder
          -&gt;add('name')
          -&gt;add('path', 'file', array('mapped' =&gt; false))
          -&gt;add('report')
      ;
  }
  </code></pre>
  
  <p>It seems like the path that's being saved is not able to be mapped to the form, and my work around was to have two form types for upload and creation, but that didn't seem like the right approach.</p>
  
  <p>What's the best way to do this? </p>