original_string: protected function addStepFileImport(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model)
      {
          // Reset the data
          $this->_session->importData = null;
  
          $this->displayHeader($bridge, $this->_('Upload a track definition file.'), 'h3');
  
          $this->addItems($bridge, 'trackFile', 'gtr_id_track');
  
          $element = $bridge->getForm()->getElement('trackFile');
  
          if ($element instanceof \Zend_Form_Element_File) {
              if (file_exists($this->_session->localfile)) {
                  unlink($this->_session->localfile);
              }
              // Now add the rename filter, the localfile is known only once after loadFormData() has run
              $element->addFilter(new \Zend_Filter_File_Rename(array(
                  'target'    => $this->_session->localfile,
                  'overwrite' => true
                  )));
  
              $uploadFileName = $element->getFileName();
  
              // Download the data oon post with filename
              if ($this->request->isPost() && $uploadFileName && $element->isValid(null)) {
                  // \MUtil_Echo::track($element->getFileName(), $element->getFileSize());
                  if (!$element->receive()) {
                      throw new \MUtil_Model_ModelException(sprintf(
                          $this->_("Error retrieving file '%s'."),
                          $element->getFileName()
                          ));
                  }
  
                  $this->_session->importData = null;
                  $this->_session->uploadFileName = basename($uploadFileName);
                  // \MUtil_Echo::track($this->_session->uploadFileName);
              }
          }
      }
code: protected function addStepFileImport(\MUtil_Model_Bridge_FormBridgeInterface $bridge, \MUtil_Model_ModelAbstract $model)
      {
          // Reset the data
          $this->_session->importData = null;
  
          $this->displayHeader($bridge, $this->_('Upload a track definition file.'), 'h3');
  
          $this->addItems($bridge, 'trackFile', 'gtr_id_track');
  
          $element = $bridge->getForm()->getElement('trackFile');
  
          if ($element instanceof \Zend_Form_Element_File) {
              if (file_exists($this->_session->localfile)) {
                  unlink($this->_session->localfile);
              }
              // Now add the rename filter, the localfile is known only once after loadFormData() has run
              $element->addFilter(new \Zend_Filter_File_Rename(array(
                  'target'    => $this->_session->localfile,
                  'overwrite' => true
                  )));
  
              $uploadFileName = $element->getFileName();
  
              // Download the data oon post with filename
              if ($this->request->isPost() && $uploadFileName && $element->isValid(null)) {
                  // \MUtil_Echo::track($element->getFileName(), $element->getFileSize());
                  if (!$element->receive()) {
                      throw new \MUtil_Model_ModelException(sprintf(
                          $this->_("Error retrieving file '%s'."),
                          $element->getFileName()
                          ));
                  }
  
                  $this->_session->importData = null;
                  $this->_session->uploadFileName = basename($uploadFileName);
                  // \MUtil_Echo::track($this->_session->uploadFileName);
              }
          }
      }
code_tokens: protected function addStepFileImport ( \ MUtil_Model_Bridge_FormBridgeInterface $ bridge , \ MUtil_Model_ModelAbstract $ model ) { // Reset the data $ this -> _session -> importData = null ; $ this -> displayHeader ( $ bridge , $ this -> _ ( 'Upload a track definition file.' ) , 'h3' ) ; $ this -> addItems ( $ bridge , 'trackFile' , 'gtr_id_track' ) ; $ element = $ bridge -> getForm ( ) -> getElement ( 'trackFile' ) ; if ( $ element instanceof \ Zend_Form_Element_File ) { if ( file_exists ( $ this -> _session -> localfile ) ) { unlink ( $ this -> _session -> localfile ) ; } // Now add the rename filter, the localfile is known only once after loadFormData() has run $ element -> addFilter ( new \ Zend_Filter_File_Rename ( array ( 'target' => $ this -> _session -> localfile , 'overwrite' => true ) ) ) ; $ uploadFileName = $ element -> getFileName ( ) ; // Download the data oon post with filename if ( $ this -> request -> isPost ( ) && $ uploadFileName && $ element -> isValid ( null ) ) { // \MUtil_Echo::track($element->getFileName(), $element->getFileSize()); if ( ! $ element -> receive ( ) ) { throw new \ MUtil_Model_ModelException ( sprintf ( $ this -> _ ( "Error retrieving file '%s'." ) , $ element -> getFileName ( ) ) ) ; } $ this -> _session -> importData = null ; $ this -> _session -> uploadFileName = basename ( $ uploadFileName ) ; // \MUtil_Echo::track($this->_session->uploadFileName); } } }
docstring: Add the elements from the model to the bridge for file upload step
  
  @param \MUtil_Model_Bridge_FormBridgeInterface $bridge
  @param \MUtil_Model_ModelAbstract $model
docstring_tokens: Add the elements from the model to the bridge for file upload step