public function PostFile::setFilename

Set the path to the file

Parameters

string $path Full path to the file:

Return value

self

Throws

InvalidArgumentException if the file cannot be read

Overrides PostFileInterface::setFilename

1 call to PostFile::setFilename()
PostFile::__construct in drupal/core/vendor/guzzle/http/Guzzle/Http/Message/PostFile.php

File

drupal/core/vendor/guzzle/http/Guzzle/Http/Message/PostFile.php, line 50

Class

PostFile
POST file upload

Namespace

Guzzle\Http\Message

Code

public function setFilename($filename) {

  // Remove leading @ symbol
  if (strpos($filename, '@') === 0) {
    $filename = substr($filename, 1);
  }
  if (!is_readable($filename)) {
    throw new InvalidArgumentException("Unable to open {$filename} for reading");
  }
  $this->filename = $filename;
  return $this;
}