Skip to content

Configuration

Publishing The Config File

Publish the configuration file to your application's config directory:

bash
php artisan vendor:publish --tag=inertia-forms-config

This creates config/inertia-forms.php with all available options.

See Installation for the setup command in context.

File Uploads

Upload configuration is grouped by responsibility:

  • temporary_uploads is the staging area for uploads received by Laravel before the form is submitted. This includes the default temporary upload endpoint and optional chunked uploads.
  • direct_to_storage is for uploads where the browser sends file bytes directly to a Laravel filesystem disk backed by S3-compatible object storage.

All max_size values are kilobytes, matching Laravel's max: file validation rule. Chunk, part, and multipart threshold values are bytes because the browser and S3 APIs work in bytes.

php
'file_uploads' => [
    'route_prefix' => '/_inertia-forms',
    'route_name' => 'inertia-forms.',
    'middleware' => ['web', 'auth'],

    'temporary_uploads' => [
        'disk' => '',
        'lifetime' => 3600, // seconds
        'max_size' => 10240, // 10 MB in kilobytes

        'chunked' => [
            'size' => 5 * 1024 * 1024, // 5 MB in bytes
            'max_size' => 2 * 1024 * 1024, // 2 GB in kilobytes
        ],
    ],

    'direct_to_storage' => [
        'disk' => '',
        'url_lifetime' => 900, // seconds
        'part_size' => 16 * 1024 * 1024, // 16 MB in bytes
        'multipart_threshold' => 100 * 1024 * 1024, // 100 MB in bytes
        'max_size' => 5 * 1024 * 1024, // 5 GB in kilobytes
    ],
],

Routes

file_uploads.route_prefix controls the URL prefix for built-in upload endpoints.

php
'route_prefix' => '/_inertia-forms',

file_uploads.route_name controls the route-name prefix for built-in upload endpoints.

php
'route_name' => 'inertia-forms.',

file_uploads.middleware controls the middleware applied to those endpoints.

php
'middleware' => ['web', 'auth'],

Add your own middleware when needed. For example, you might add a throttle middleware to limit upload frequency.

For separate application sections, register additional upload route groups and point fields at them with uploadRoutes(). See File Upload Routes for the route-group example and naming rule.

Temporary Uploads

file_uploads.temporary_uploads.disk controls the staging disk used by temporary uploads before the form is submitted. An empty value creates a local disk at storage/inertia-forms-temporary-uploads.

php
'disk' => '',

Set this to any disk defined in config/filesystems.php if temporary upload tokens should stage files somewhere else. This does not decide where your application stores the final file. The final destination is still chosen later by your controller, Media Library sync, or other application code.

file_uploads.temporary_uploads.lifetime controls how long a temporary upload is kept before cleanup.

php
'lifetime' => 3600,

file_uploads.temporary_uploads.max_size is the maximum file size, in kilobytes, accepted by the built-in temporary upload endpoint.

php
'max_size' => 10240,

Individual fields may set their own maxSize() rules. Those field rules are validated separately during upload.

Chunked Temporary Uploads

file_uploads.temporary_uploads.chunked.size is the default chunk size, in bytes, for fields using chunked().

php
'size' => 5 * 1024 * 1024,

Fields may override this with chunked(size: 8 * 1024 * 1024).

file_uploads.temporary_uploads.chunked.max_size is the maximum declared file size, in kilobytes, accepted by the chunked upload endpoint. The default is 2 GB.

php
'max_size' => 2 * 1024 * 1024,

Direct To Storage

file_uploads.direct_to_storage.disk is the Laravel filesystem disk used when a field calls directToStorage() without a disk name. The value should be a disk from config/filesystems.php, just like the name you would pass to Storage::disk().

php
'disk' => '',

An empty value uses the s3 disk. Fields may override this with directToStorage('minio') or uploadDisk('minio').

Inertia Forms infers the upload implementation from the Laravel filesystem disk driver. Disks using Laravel's s3 filesystem driver use the built-in S3-compatible upload driver. Local disks are supported for tests and local same-origin endpoint coverage. For application-facing large local uploads, prefer chunked().

file_uploads.direct_to_storage.url_lifetime controls how long signed storage URLs remain valid.

php
'url_lifetime' => 900,

file_uploads.direct_to_storage.part_size is the default multipart part size, in bytes.

php
'part_size' => 16 * 1024 * 1024,

Fields may override this with partSize().

file_uploads.direct_to_storage.multipart_threshold is the file size threshold, in bytes, above which direct-to-storage uploads use multipart mode. Files at or below this threshold use a single signed PUT.

php
'multipart_threshold' => 100 * 1024 * 1024,

Fields may override this with multipartThreshold().

file_uploads.direct_to_storage.max_size is the maximum declared file size, in kilobytes, accepted by the direct upload endpoint. The default is 5 GB.

php
'max_size' => 5 * 1024 * 1024,

Authorization

authorization.throw_on_unauthorized

Controls what happens when a form fails its authorization check. With false (the default), an unauthorized form returns an empty structure. With true, it throws a 403 AuthorizationException. Unauthorized fields are always silently omitted, regardless of this setting.

php
'throw_on_unauthorized' => false,

Full Default Configuration

php
return [
    'file_uploads' => [
        'route_prefix' => '/_inertia-forms',
        'route_name' => 'inertia-forms.',
        'middleware' => ['web', 'auth'],

        'temporary_uploads' => [
            'disk' => '',
            'lifetime' => 3600, // seconds
            'max_size' => 10240, // 10 MB in kilobytes

            'chunked' => [
                'size' => 5 * 1024 * 1024, // 5 MB in bytes
                'max_size' => 2 * 1024 * 1024, // 2 GB in kilobytes
            ],
        ],

        'direct_to_storage' => [
            'disk' => '',
            'url_lifetime' => 900, // seconds
            'part_size' => 16 * 1024 * 1024, // 16 MB in bytes
            'multipart_threshold' => 100 * 1024 * 1024, // 100 MB in bytes
            'max_size' => 5 * 1024 * 1024, // 5 GB in kilobytes
        ],
    ],

    'authorization' => [
        'throw_on_unauthorized' => false,
    ],
];

Using Environment Variables

The published config uses literal defaults. You may replace values in your own config/inertia-forms.php file with env(...) when your application needs environment-driven configuration.