Upload Routes
Register the upload routes in your routes/web.php file:
use Illuminate\Support\Facades\Route;
Route::inertiaFormUploads();By default, this registers the built-in endpoints under /_inertia-forms. You usually don't need to call these routes yourself, because the frontend field reads the route URLs from the serialized field configuration.
Temporary uploads use two endpoints with the default route name prefix:
POST /_inertia-forms/file-upload(inertia-forms.file-upload.store) stores a selected file and returns an encrypted temporary upload token.DELETE /_inertia-forms/file-upload(inertia-forms.file-upload.destroy) removes an unused temporary upload.
Chunked uploads add a small route group below /_inertia-forms/file-upload/chunked:
startcreates a pending upload.statuschecks which bytes have already been received.chunkappends the next chunk.completeturns the uploaded chunks into a temporary upload token.abortcancels the pending upload.
Direct-to-storage uploads add a route group below /_inertia-forms/file-upload/direct:
startcreates a signed single-object or multipart upload.objectreceives local test-driverPUTuploads.partsigns or receives individual multipart parts.statuschecks the parts already uploaded.completevalidates the stored object and returns a temporary upload token.abortcancels an unfinished upload.
Customizing Routes
You may customize the prefix and middleware:
Route::inertiaFormUploads(
prefix: '/uploads',
middleware: ['web', 'auth', 'throttle:60,1'],
);To give a separate section of your application its own endpoints, register another route group with its own route name prefix:
Route::prefix('admin')
->name('admin.')
->group(function () {
Route::inertiaFormUploads(
prefix: '/backoffice/_inertia-forms',
middleware: ['web', 'auth', 'can:access-admin'],
name: 'backoffice',
);
});The uploadRoutes method points a field at that route group. The selected group supplies the field's temporary, delete, chunked, and direct-to-storage endpoints:
use InertiaUI\Forms\Fields\File;
File::make('avatar')
->uploadRoutes('admin.backoffice');Pass the full route name prefix, as Laravel composes it from the parent route groups and the upload route group's name.
A group's prefix may have parameters. Pass their values as the second argument:
Route::inertiaFormUploads('media-uploads/{auth}', ['web'], 'media-uploads');
File::make('photo')
->chunked()
->uploadRoutes('media-uploads', ['auth' => 'user']);An upload stays in the group and under the parameter values it started with. Another group, or another {auth} value, rejects its upload ID.
A field's upload rules token is bound to its group once that group has rules, metadata, or a complete hook. The form then only accepts keys from that group's endpoints, so it rejects a file uploaded through a less strict group. A chunked field of a group with a completion hook only accepts keys from the group's chunked endpoints, since only they run the hook.
Route Group Options
The fourth argument of Route::inertiaFormUploads() configures one group:
| Option | Meaning |
|---|---|
rules | File validation rules applied to every transport. Use string rules. |
max_size | Maximum chunked upload size in kilobytes. Overrides the global limit. |
lifetime | Lifetime of a chunked upload and its key in seconds, including cleanup. |
chunk_size | Maximum chunk size in bytes. Fields using this group inherit it. |
metadata | Validation rules for metadata sent at the start of a chunked upload. |
complete | A class implementing HandlesCompletedUploads. See Completion Hook. |
Size limits are checked before the upload starts. File types and other rules are checked against the received contents.
Route::inertiaFormUploads('imports', ['web', 'auth'], 'imports', [
'rules' => ['mimetypes:text/csv,text/plain'],
'max_size' => 8 * 1024 * 1024, // 8 GB
'lifetime' => 6 * 3600,
]);Serialized Upload Configuration
The PHP upload methods serialize to the same public props that the standalone Vue and React controls accept. Generated fields fill in the route URLs and the validation token automatically. Standalone controls must provide the values their chosen transport requires.
| Prop | Meaning |
|---|---|
storeWithForm | Keep native browser File objects for the final multipart form request. It bypasses temporary, chunked, and direct uploaders. |
temporaryUploadUrl | Regular multipart upload endpoint. The request field is file, and the response may supply the submitted value as key, path, url, or id. |
temporaryUploadDeleteUrl | Optional delete endpoint used to discard a completed temporary upload that the user removes. |
chunked / chunkSize | Enable same-origin chunking and set bytes per append request, up to the chunk size the start endpoint returns. |
chunkedUrls | Endpoints named start, status, append, complete, and abort. All are required for standalone chunked uploads. |
concurrentUploads | Maximum number of this field's files that upload at the same time. Defaults to 3. Other files wait in a queue. |
directToStorage / uploadDisk | Enable direct upload and identify the Laravel filesystem disk bound to the signing endpoint. |
uploadPartSize / uploadMultipartThreshold | Set multipart part bytes and the byte threshold above which direct uploads become multipart. |
directUploadUrls | Endpoints named start, signPart, status, complete, and abort. All are required for standalone direct uploads. |
uploadRulesToken | Encrypted package upload profile sent with managed upload requests. It carries upload validation rules and binds built-in direct-to-storage requests to their intended disk. Applications normally obtain it from serialized PHP props. |
requiresUploadRulesToken | Require the completed temporary token to prove it used the expected validation profile in the final request. |
The FileUpload field also accepts existingFiles as an explicit initial list. A non-empty list takes precedence over the existing-file objects in the initial bound value. Composer applies the same transport props to its attachments. RichText nests them under imageUploads and never supports storeWithForm.