original_string: protected function attachFile($fileName, $selector)
      {
          if ($this->getMinkParameter('files_path')) {
              $fullPath = rtrim(
                  realpath(
                      $this->getMinkParameter('files_path')
                  ),
                  DIRECTORY_SEPARATOR
              ) . DIRECTORY_SEPARATOR . $fileName;
  
              if (is_file($fullPath)) {
                  $fileInput = 'input[type="file"]' . $selector;
                  $field = $this->getSession()->getPage()->find('css', $fileInput);
  
                  if (null === $field) {
                      throw new Exception("File input $selector is not found");
                  }
                  $field->attachFile($fullPath);
              }
          } else {
              throw new Exception("File $fileName is not found at the given location: $fullPath");
          }
      }
code: protected function attachFile($fileName, $selector)
      {
          if ($this->getMinkParameter('files_path')) {
              $fullPath = rtrim(
                  realpath(
                      $this->getMinkParameter('files_path')
                  ),
                  DIRECTORY_SEPARATOR
              ) . DIRECTORY_SEPARATOR . $fileName;
  
              if (is_file($fullPath)) {
                  $fileInput = 'input[type="file"]' . $selector;
                  $field = $this->getSession()->getPage()->find('css', $fileInput);
  
                  if (null === $field) {
                      throw new Exception("File input $selector is not found");
                  }
                  $field->attachFile($fullPath);
              }
          } else {
              throw new Exception("File $fileName is not found at the given location: $fullPath");
          }
      }
code_tokens: protected function attachFile ( $ fileName , $ selector ) { if ( $ this -> getMinkParameter ( 'files_path' ) ) { $ fullPath = rtrim ( realpath ( $ this -> getMinkParameter ( 'files_path' ) ) , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . $ fileName ; if ( is_file ( $ fullPath ) ) { $ fileInput = 'input[type="file"]' . $ selector ; $ field = $ this -> getSession ( ) -> getPage ( ) -> find ( 'css' , $ fileInput ) ; if ( null === $ field ) { throw new Exception ( "File input $selector is not found" ) ; } $ field -> attachFile ( $ fullPath ) ; } } else { throw new Exception ( "File $fileName is not found at the given location: $fullPath" ) ; } }
docstring: Attaches a file to a input field on the HTML.
  
  @param   string $file        file name relative to mink definitions
  @param   string $selector    CSS file upload element selector
docstring_tokens: Attaches a file to a input field on the HTML .