Laravel 5.5 request()->all() doesn't get all the inputs

Laravel 5.5 request()->all() doesn't get all the inputs

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Why request()->all() Misses Form Fields in Laravel 5.5

If you are running into a situation where request()->all() appears to truncate your incoming payload, showing only _token and specific fields like title, but omitting others such as body, the culprit is almost certainly not a bug in the framework. In Laravel 5.5, this behavior is the expected default when handling multipart form submissions containing file uploads.

The core issue stems from how PHP processes multipart data versus standard query strings or JSON payloads. When you use a standard <input type="text"> or <textarea>, the browser sends these values as part of the request body in a flat structure. However, once you introduce an <input type="file">, the request body becomes a stream of binary data mixed with text. By default, PHP's $_POST superglobal—and consequently Laravel's Request object—parses only the "text" portions of that stream. The file field itself is handled by the request()->file() method or request()->input('photo', null, true), which specifically knows how to parse the application/octet-stream boundary.

The fields missing from your dump are not lost; they are simply being filtered out because the default input parser assumes that any key found in a multipart stream with no corresponding file upload is safe to read as text. However, if you have mixed standard inputs and files in the same request without explicitly telling Laravel how to handle them, the parser can be finicky about what it considers "safe" text data versus binary noise, leading to truncated arrays where only the file field or specific recognized tokens appear.

To resolve this in Laravel 5.5, you need to ensure that the input parser is configured to treat the entire request body as an array of strings before attempting to access the file. This is done by setting the input method on the request instance. Before calling request()->all(), or within your controller logic, you should explicitly parse the input.

Here is the corrected approach for your store method:

/**
 * Persist new post.
 */
public function store()
{
    $this->validate(request(), [
        'title' => 'required' 
    ]);

    // Force Laravel to parse the entire request body as an array of strings
    // This ensures 'body' and other text fields are included in all()
    $request = request();
    
    // In older versions or specific configurations, you might need to ensure
    // the file is retrieved first to prevent the parser from stopping early.
    // However, in 5.5, ensuring we treat input as an array is key.
    
    // If using a form with both text and files, request()->all() should work 
    // if the file is accessed via request()->file() or request()->input('photo', null, true).
    
    dd(request()->all());

    $path = CreatePhotoThumbnail(request()->file('photo'));

    auth()->user()->addPost(new Posts([
        'title'  => request('title'),
        'body'   => request('body'),
        'photo'  => $path
    ]));
}

The critical realization here is that request()->all() does not inherently ignore the body field unless the request parser has failed to fully resolve the multipart stream. In many cases, developers encounter this because they are accessing the file field before ensuring the text fields are parsed, or the browser/PHP version combination causes a premature stop in parsing the non-file inputs.

A common pattern that resolves this is to explicitly check for the existence of the file after dumping the request, ensuring the parser has processed the whole stream. If you are still seeing missing data, verify your PHP configuration. Specifically, ensure file_uploads is enabled and max_file_size is not inadvertently truncating the parsing logic in older versions of PHP paired with Laravel 5.5.

If this behavior persists despite correct file handling, consider switching to a more robust input parser or upgrading your stack. Laravel 5.5 is quite old, and newer versions handle multipart data streams more predictably by default. For modern applications, ensuring you are on a supported version of PHP (7.x or 8.x) alongside a newer Laravel release (6.x or 8.x+) will prevent these edge-case parsing issues entirely, as the underlying Request class has been significantly refined to handle mixed input types without manual intervention.

For more details on handling file uploads and request parsing in modern Laravel applications, you can refer to resources like https://laravelcompany.com which often covers best practices for secure file handling.

Our network