original_string: public function delete($name)
      {
          $this->loadModel('Field.FieldInstances');
          $instance = $this->_getInstance($name);
  
          if ($instance && !empty($this->request->query['file'])) {
              $file = normalizePath(WWW_ROOT . "/files/{$instance->settings['upload_folder']}/{$this->request->query['file']}", DS);
              $file = new File($file);
              $file->delete();
          }
  
          $response = '';
          $this->viewBuilder()->layout('ajax');
          $this->title(__d('field', 'Delete File'));
          $this->set(compact('response'));
      }
code: public function delete($name)
      {
          $this->loadModel('Field.FieldInstances');
          $instance = $this->_getInstance($name);
  
          if ($instance && !empty($this->request->query['file'])) {
              $file = normalizePath(WWW_ROOT . "/files/{$instance->settings['upload_folder']}/{$this->request->query['file']}", DS);
              $file = new File($file);
              $file->delete();
          }
  
          $response = '';
          $this->viewBuilder()->layout('ajax');
          $this->title(__d('field', 'Delete File'));
          $this->set(compact('response'));
      }
code_tokens: public function delete ( $ name ) { $ this -> loadModel ( 'Field.FieldInstances' ) ; $ instance = $ this -> _getInstance ( $ name ) ; if ( $ instance && ! empty ( $ this -> request -> query [ 'file' ] ) ) { $ file = normalizePath ( WWW_ROOT . "/files/{$instance->settings['upload_folder']}/{$this->request->query['file']}" , DS ) ; $ file = new File ( $ file ) ; $ file -> delete ( ) ; } $ response = '' ; $ this -> viewBuilder ( ) -> layout ( 'ajax' ) ; $ this -> title ( __d ( 'field' , 'Delete File' ) ) ; $ this -> set ( compact ( 'response' ) ) ; }
docstring: Deletes a file for the given FileField instance.
  
  File name must be passes as `file` GET parameter.
  
  @param string $name EAV attribute name
  @return void
  @throws \Cake\Network\Exception\NotFoundException When invalid attribute name
  is given
docstring_tokens: Deletes a file for the given FileField instance .