protected function Client::addPostFiles in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/fabpot/goutte/Goutte/Client.php \Goutte\Client::addPostFiles()
1 call to Client::addPostFiles()
- Client::doRequest in vendor/
fabpot/ goutte/ Goutte/ Client.php
File
- vendor/
fabpot/ goutte/ Goutte/ Client.php, line 149
Class
- Client
- Client.
Namespace
GoutteCode
protected function addPostFiles(array $files, array &$multipart, $arrayName = '') {
if (empty($files)) {
return;
}
foreach ($files as $name => $info) {
if (!empty($arrayName)) {
$name = $arrayName . '[' . $name . ']';
}
$file = [
'name' => $name,
];
if (is_array($info)) {
if (isset($info['tmp_name'])) {
if ('' !== $info['tmp_name']) {
$file['contents'] = fopen($info['tmp_name'], 'r');
if (isset($info['name'])) {
$file['filename'] = $info['name'];
}
}
else {
continue;
}
}
else {
$this
->addPostFiles($info, $multipart, $name);
continue;
}
}
else {
$file['contents'] = fopen($info, 'r');
}
$multipart[] = $file;
}
}