public function processAll()
{
$content_range = $this->getContentRange();
$size = $this->getSize();
$this->files = array();
$upload = $this->upload;
if ($this->logger) {
$this->logger->debug('Processing uploads', array('Content-range' => $content_range, 'Size' => $size, 'Upload array' => $upload, 'Server array' => $this->server));
}
if ($upload && is_array($upload['tmp_name'])) {
foreach ($upload['tmp_name'] as $index => $tmp_name) {
if (empty($tmp_name)) {
// Discard empty uploads
continue;
}
$this->files[] = (object) (array) $this->process($tmp_name, $upload['name'][$index], $size ? $size : $upload['size'][$index], $upload['type'][$index], $upload['error'][$index], $index, $content_range);
}
} else {
if ($upload && !empty($upload['tmp_name'])) {
$this->files[] = $this->process($upload['tmp_name'], $upload['name'], $size ? $size : (isset($upload['size']) ? $upload['size'] : $this->getContentLength()), isset($upload['type']) ? $upload['type'] : $this->getContentType(), $upload['error'], 0, $content_range);
} else {
if ($upload && $upload['error'] != 0) {
$file = $this->getFileContainer();
$file->error = $this->getMessage($upload['error']);
$file->error_code = $upload['error'];
$this->files[] = $file;
}
}
}
return array($this->files, $this->getNewHeaders($this->files, $content_range));
}