mnapoli/laravel-local-temporary-upload-url

Adds temporaryUploadUrl() support to Laravel's local filesystem driver

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/mnapoli/laravel-local-temporary-upload-url

1.0.0 2026-01-22 21:16 UTC

This package is auto-updated.

Last update: 2026-01-22 21:17:57 UTC


README

Adds temporaryUploadUrl() support to Laravel's local filesystem driver.

This allows the same S3 upload flow (presigned URL + direct PUT) to work in local development without requiring S3/MinIO.

Installation

composer require mnapoli/laravel-local-temporary-upload-url

The package auto-registers its service provider.

Usage

Use temporaryUploadUrl() exactly like you would with S3:

use Illuminate\Support\Facades\Storage;

[$url, $headers] = Storage::temporaryUploadUrl(
    'uploads/my-file.txt',
    now()->addMinutes(5)
);

Then upload directly via PUT:

await fetch(url, {
    method: 'PUT',
    body: file,
});

Configuration

Optionally publish the config file:

php artisan vendor:publish --provider="LocalTemporaryUpload\LocalTemporaryUploadServiceProvider" --tag=config

Frontend example

async function uploadFile(file) {
    // Get the presigned URL from your backend
    const response = await fetch('/api/upload-url', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ filename: file.name }),
    });
    const { url } = await response.json();

    // Upload directly to the signed URL
    await fetch(url, {
        method: 'PUT',
        body: file,
    });
}