Add POST files to use in the upload
array $files An array of POST fields => filenames where filename can be a string or PostFileInterface:
EntityEnclosingRequestInterface
Overrides EntityEnclosingRequestInterface::addPostFiles
public function addPostFiles(array $files) {
foreach ($files as $key => $file) {
if ($file instanceof PostFileInterface) {
$this
->addPostFile($file, null, null, false);
}
elseif (is_string($file)) {
// Convert non-associative array keys into 'file'
if (is_numeric($key)) {
$key = 'file';
}
$this
->addPostFile($key, $file, null, false);
}
else {
throw new RequestException('File must be a string or instance of PostFileInterface');
}
}
return $this;
}