/**
  * check if the request has sent some headers
  */
 private function _validate_headers()
 {
     // check the security nonce
     if (is_callable($this->on_chk_nonce)) {
         $nonce = $this->_get_header_value(UPLOADER_NONCE_HEADER);
         if ($nonce) {
             if (!call_user_func($this->on_chk_nonce, $nonce)) {
                 $this->_set_error(_esc('Security nonce error'), "3.0.a", false);
             }
         } else {
             $this->_set_error(_esc('Security nonce is required'), "3.0.b", false);
         }
     }
     $this->_content_type = $this->_get_header_value(UPLOADER_TYPE_HEADER);
     $header_error = _esc('%s header expected');
     if ($this->_filename) {
         // overwrite the old file
         _is_file($this->_filename) && unlink($this->_filename);
         $this->_raw_post = $this->is_raw_post();
     } else {
         $this->_set_error(sprintf($header_error, UPLOADER_FILENAME_HEADER), 3.1, false);
     }
     // we expect a header that provides the uploaded chunk range
     if (!$this->_abort) {
         ($this->_range = $this->get_range()) || $this->_set_error(sprintf($header_error, UPLOADER_RANGE_HEADER), 3.2, false);
     }
 }
Example #2
0
 public function isFile()
 {
     return !_is_dir($this->_path) and _is_file($this->_path);
 }