title: Edit form with file input in zend framework 2
body: <p>I use fielrenameupload validation and fileprg to upload file in my form .
  It works very well but in edit action validation fails for file input
  How I can solve this problem in edit action ?</p>
  
  <p>this is edit action that works great for add action :</p>
  
  <pre><code>public function editAction()
      {
          $id = $this-&gt;params()-&gt;fromRoute('id',0);
          $category = $this-&gt;categoryTable-&gt;get($id);
  
          $form = $this-&gt;getServiceLocator()-&gt;get('CategoryForm');
  
          $prg = $this-&gt;fileprg($form);
          $form-&gt;bind($category);
  
          if ($prg instanceof \Zend\Http\PhpEnviroment\Response)
          {
              return $prg;
          }
          elseif (is_array($prg))
          {
              if ($form-&gt;isValid())
              {
                  $data = $form-&gt;getData();
                  $data['image'] = $data['image']['tmp_name'];
                  $category = new CategoryEntity;
                  $category-&gt;exchangeArray($data);
  
                  if ($this-&gt;categoryTable-&gt;save($category))
                      $this-&gt;redirect()-&gt;toRoute(null,array('action'=&gt;'index'));
              }
          }
  
          $view = new ViewModel(array(
              'form'  =&gt;  $form,
          ));
          $view-&gt;setTemplate('category/admin/add');
          return $view;
      }
  </code></pre>
  
  <p>And this is validation code for file input :</p>
  
  <pre><code>$image = new \Zend\InputFilter\FileInput('image');
          $image-&gt;getFilterChain()-&gt;attachByName('filerenameupload',array(
              'target'    =&gt;  'data/upload/images/category',
              'use_upload_name'   =&gt;  true,
              'randomize'     =&gt;  true,
          ));
  </code></pre>