public function processAll()
    {
        $content_range = $this->getContentRange();
        $size = $this->getSize();
        $this->files = [];
        $upload = $this->upload;

        if ($this->logger) {
            $this->logger->debug('Processing uploads', [
                '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[] = $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) {
                    // $this->fileContainer is empty at this point
                    // $upload['tmp_name'] is also empty
                    // So we create a File instance from $upload['name']
                    $file = new File($upload['name'], basename($upload['name']));
                    $file->error = $this->getMessage($upload['error']);
                    $file->errorCode = $upload['error'];
                    $this->files[] = $file;
                }
            }
        }

        return [$this->files, $this->getNewHeaders($this->files, $content_range)];
    }