original_string: public function upload()
      {
          if (!isset($this->_package['tmp_name']) || !is_readable($this->_package['tmp_name'])) {
              $this->_error(__d('installer', 'Invalid package.'));
  
              return false;
          } elseif (!isset($this->_package['name']) || !str_ends_with(strtolower($this->_package['name']), '.zip')) {
              $this->_error(__d('installer', 'Invalid package format, it is not a ZIP package.'));
  
              return false;
          } else {
              $dst = normalizePath(TMP . $this->_package['name']);
              if (is_readable($dst)) {
                  $file = new File($dst);
                  $file->delete();
              }
  
              if (move_uploaded_file($this->_package['tmp_name'], $dst)) {
                  $this->_dst = $dst;
  
                  return true;
              }
          }
  
          $this->_error(__d('installer', 'Package could not be uploaded, please check write permissions on /tmp directory.'));
  
          return false;
      }
code: public function upload()
      {
          if (!isset($this->_package['tmp_name']) || !is_readable($this->_package['tmp_name'])) {
              $this->_error(__d('installer', 'Invalid package.'));
  
              return false;
          } elseif (!isset($this->_package['name']) || !str_ends_with(strtolower($this->_package['name']), '.zip')) {
              $this->_error(__d('installer', 'Invalid package format, it is not a ZIP package.'));
  
              return false;
          } else {
              $dst = normalizePath(TMP . $this->_package['name']);
              if (is_readable($dst)) {
                  $file = new File($dst);
                  $file->delete();
              }
  
              if (move_uploaded_file($this->_package['tmp_name'], $dst)) {
                  $this->_dst = $dst;
  
                  return true;
              }
          }
  
          $this->_error(__d('installer', 'Package could not be uploaded, please check write permissions on /tmp directory.'));
  
          return false;
      }
code_tokens: public function upload ( ) { if ( ! isset ( $ this -> _package [ 'tmp_name' ] ) || ! is_readable ( $ this -> _package [ 'tmp_name' ] ) ) { $ this -> _error ( __d ( 'installer' , 'Invalid package.' ) ) ; return false ; } elseif ( ! isset ( $ this -> _package [ 'name' ] ) || ! str_ends_with ( strtolower ( $ this -> _package [ 'name' ] ) , '.zip' ) ) { $ this -> _error ( __d ( 'installer' , 'Invalid package format, it is not a ZIP package.' ) ) ; return false ; } else { $ dst = normalizePath ( TMP . $ this -> _package [ 'name' ] ) ; if ( is_readable ( $ dst ) ) { $ file = new File ( $ dst ) ; $ file -> delete ( ) ; } if ( move_uploaded_file ( $ this -> _package [ 'tmp_name' ] , $ dst ) ) { $ this -> _dst = $ dst ; return true ; } } $ this -> _error ( __d ( 'installer' , 'Package could not be uploaded, please check write permissions on /tmp directory.' ) ) ; return false ; }
docstring: Uploads a ZIP package to the server.
  
  @return bool True on success
docstring_tokens: Uploads a ZIP package to the server .