title: How to add file element in zend form?
body: <p>I am creating forms like this:</p>
  
  <p><strong>UploadFiale.php</strong></p>
  
  <pre><code>&lt;?php 
  
  class Form_UploadFile extends Zend_Form {
  
      public function __construct( $options = null ) {
  
          parent::__construct( $options );    
          $this-&gt;setMethod('post');
          $elements = array();
  
          // photo
          $element = new Zend_Form_Element_File('photo');
          $element-&gt;setLabel('Photo');
          $element-&gt;addValidator('Count', false, 1);
          $element-&gt;addValidator('Size', false, 102400);
          $element-&gt;addValidator('Extension', false, 'jpg,png,gif');
          $elements[] = $element;
  
          // submit button      
          $element = $this-&gt;CreateElement('submit', 'submit');
          $element-&gt;setLabel('Save');
          $elements[] = $element;
  
          $this-&gt;addElements( $elements );
          $this-&gt;setElementDecorators( array( 'ViewHelper' ) );          
          $this-&gt;setDecorators( array( array( 'ViewScript', array( 'viewScript' =&gt; 'uploadfile-form.phtml' ) ) ) );
  
      } // end construct       
  } // end class
  ?&gt;
  </code></pre>
  
  <p><strong>uploadfile-form.phtml</strong></p>
  
  <pre><code>&lt;form action=&lt;?= $this-&gt;element-&gt;getAction() ?&gt; method=&lt;?= $this-&gt;element-&gt;getMethod() ?&gt; id='AddNotificationForm' enctype='multipart/form-data' class='AjaxForm'&gt;    
  &lt;table border='0'&gt;   
      &lt;tr&gt;
          &lt;td&gt;&lt;label&gt;&lt;?= $this-&gt;element-&gt;photo-&gt;getLabel() ?&gt;&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?= $this-&gt;element-&gt;photo; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?= $this-&gt;element-&gt;submit; ?&gt;&lt;/td&gt;
      &lt;/tr&gt;       
  &lt;/table&gt;    
  &lt;/form&gt;
  </code></pre>
  
  <p>When I initialize form class and render it in view then <strong>I am getting following error:</strong></p>
  
  <blockquote>
    <p>Warning: No file decorator found... unable to render file element in
    /project_folder/library/Zend/Form/Element.php on line 2041</p>
  </blockquote>
  
  <p>Same structure is working with other form elements but not working with <strong>file</strong> element. Can someone tell me that what is wrong here ?</p>
  
  <p>Thanks</p>