isMethod('POST') && $request->header('Content-Type', '') === 'application/json') { $content = $request->getContent(); $data = json_decode($content, true); if (json_last_error() === JSON_ERROR_NONE) { // Check if any file uploads are present in the request $this->checkUploadLimits($data, $request); } } $response = $next($request); return $response; } protected function checkUploadLimits(array $data, Request $request): void { // Check PHP upload limits $uploadMax = $this->parseSize(ini_get('upload_max_filesize')); $postMax = $this->parseSize(ini_get('post_max_size')); // Log current limits for debugging Log::info('Upload limits', [ 'upload_max_filesize' => ini_get('upload_max_filesize'), 'post_max_size' => ini_get('post_max_size'), 'content_length' => $request->header('Content-Length'), ]); } protected function parseSize(string $size): int { $unit = strtolower(substr($size, -1)); $value = (int) $size; return match ($unit) { 'g' => $value * 1024 * 1024 * 1024, 'm' => $value * 1024 * 1024, 'k' => $value * 1024, default => $value, }; } }