All pastes #434316 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-11 10:56 UTC
rendered paste body
  public function executeUpload() {
    $modelo = ModeloPeer::retrieveByPk($this->getRequestParameter('cd_cliente'),
                               $this->getRequestParameter('cd_categoria'),
                               $this->getRequestParameter('cd_modelo'));
    $this->forward404Unless($modelo);
    if($this->getRequest()->hasFiles()) {
      switch($this->getRequestParameter('sct_upload')) {
        case 0: { $prefixo = '/com_'; $uobj = new Componente; break; }
        #add cases
      }
      $cpath = "/var/www/projects/clients";
      $tpath = "/var/www/projects/temp";
      $upload = $this->getRequest()->getFileName('fil_upload');
      if(!$upload) {
        $this->redirect('modelo/show');
      } else {
        $upath = $cpath;
        $upath .= '/cli_'.$modelo->getCdCliente();
        if(!is_dir($upath)) mkdir($upath, 0755);
        if(!is_dir($upath)) $this->forward('security', 'access');
        $upath .= '/mod_'.$modelo->getCdModelo();
        if(!is_dir($upath)) mkdir($upath, 0755);
        if(!is_dir($upath)) $this->forward('security', 'access');
        $uobj->setCdCliente = $modelo->getCdCliente();
        $uobj->setCdCategoria = $modelo->getCdCategoria();
        $uobj->setCdModelo = $modelo->getCdModelo();
        $uobj->setDs($this->getRequestParameter('txt_upload'));
        $uobj->save();
        # get the extension...
        $ufile = $upath.$prefixo.$uobj->getCd().'.png';
        if(!$this->getRequest()->moveFile('fil_upload', $ufile)) {
          //$this->forward('security', 'access');
        }
        $uobj->setDsPath($ufile);
        # fix the insert ***********
        $uobj->save();
        $this->redirect('modelo/show');
      }
    } else {
      $this->forward('modelo','list');
    }