title: How to Edit Uploaded Image in symfony
body: <p>I want to edit existing image but I could not update .Please can anyone help me.</p>
  
  <p>I have used my form type in this way</p>
  
  <pre><code>$builder-&gt;add('picture', FileType::class,['label'=&gt; 'Picture', 'required'=&gt; false, 'data_class'=&gt; null]);
      $builder-&gt;add('submit',SubmitType::class, ['label' =&gt; 'Submit', 'attr' =&gt; ['class'=&gt;'contact100-form-btn']]);
  </code></pre>
  
  <p>I have following entity</p>
  
  <pre><code> /**
   * @var string
   *
   * @ORM\Column(name="picture", type="string", length=255, nullable=true)
   *
   */
  private $picture;
  </code></pre>
  
  <p>I have used my form handling in this way</p>
  
  <pre><code>$form = $this-&gt;createForm(userType::class, $userEntity, ['action'=&gt;$actionUrl]);
      $form-&gt;handleRequest($request);
      if ($form-&gt;isSubmitted()) {
          dump($form-&gt;getData());die;}
  </code></pre>
  
  <p>Now when I am using  this form in twig <code>{{ form_widget(form.picture) }}</code> the value is missing in input field <code>&lt;input type= "file" name= "picture"&gt;</code> I am not getting value of existing image on upload button.</p>
  
  <p>controller for edit action</p>
  
  <pre><code>public function editUserData(Request $request, $id) {
  
      $userEntity = $this-&gt;get('app.manage.user_data')-&gt;getUserById($id);
      $actionUrl = $this-&gt;generateUrl('edit_user_data', ['id' =&gt; $id]);
      $form = $this-&gt;createForm(userType::class, $userEntity, ['action' =&gt; $actionUrl]);
      $form-&gt;handleRequest($request);
      if ($form-&gt;isSubmitted()) {
          dump($form-&gt;getData());die;
          $this-&gt;addOrEditUserData($userEntity, $form, $id);
          $this-&gt;addFlash("success", "Your have successfully changes data of id=" . $id);
  
          return $this-&gt;redirect($this-&gt;generateUrl('display_user_data'));
      }
  
      return $this-&gt;render('@LillyDoo/Narayan/_edit.userData.html.twig', [
          'form' =&gt; $form-&gt;createView()
  
      ]);
  }
  </code></pre>
  
  <p>Please can any help me how I can update existing image.</p>
  
  <p>Thanks</p>