Skip to content

[6.x] Make Files fieldtype temporary upload storage configurable#14733

Merged
jasonvarga merged 4 commits into
6.xfrom
file-uploads-filesystem
Jul 15, 2026
Merged

[6.x] Make Files fieldtype temporary upload storage configurable#14733
jasonvarga merged 4 commits into
6.xfrom
file-uploads-filesystem

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented May 27, 2026

Copy link
Copy Markdown
Member

This pull request makes the Files fieldtype's temporary upload storage configurable, allowing files to be stored on a shared filesystem for multi-server environments.

Previously, temporary file uploads were hardcoded to use the local disk at statamic/file-uploads. This caused issues in multi-server setups where a file might be uploaded on one server but processed (e.g., queued form emails with attachments) on another.

This PR adds two new config options in config/system.php:

'file_uploads_disk' => env('STATAMIC_FILE_UPLOADS_DISK', 'local'),
'file_uploads_path' => env('STATAMIC_FILE_UPLOADS_PATH', 'statamic/file-uploads'),

These can be configured via environment variables to use a shared filesystem like S3:

STATAMIC_FILE_UPLOADS_DISK=s3
STATAMIC_FILE_UPLOADS_PATH=statamic/file-uploads

This PR also adds a test to verify the configured disk is used.


Requested on Twitter: https://x.com/adampatterson/status/2057113369623298060

@adampatterson

Copy link
Copy Markdown
Contributor

Awesome, thanks so much!

This should work nicely with Livewire Forms

jasonvarga and others added 3 commits July 14, 2026 10:14
Splits the nested file_uploads.disk/path config into top-level
file_uploads_disk and file_uploads_path settings, matching the flat
key convention used elsewhere in config/system.php. Keeping disk and
path as distinct top-level keys also makes it easier for other kinds
of temporary uploads (e.g. forms) to reuse the same disk via their
own dedicated path setting.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Covers the write path (FileUploader via the Files fieldtype upload
route), the DeleteTemporaryFileUploads cleanup middleware, and the
DeleteTemporaryAttachments form job, asserting each respects the
file_uploads_disk/file_uploads_path config instead of the hardcoded
local disk and statamic/file-uploads path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jasonvarga jasonvarga enabled auto-merge (squash) July 15, 2026 20:37
@jasonvarga jasonvarga merged commit c07fed4 into 6.x Jul 15, 2026
23 checks passed
@jasonvarga jasonvarga deleted the file-uploads-filesystem branch July 15, 2026 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants