laravel/framework · error · RuntimeException
This driver does not support creating temporary URLs.
Error message
This driver does not support creating temporary URLs.
What it means
Thrown by LocalFilesystemAdapter::temporaryUrl() when the adapter cannot produce a temporary URL. The local driver only supports temporary URLs when a custom temporaryUrlCallback is registered OR signed-URL serving is enabled ($shouldServeSignedUrls) with a URL-generator resolver. Without either, generating a temporary URL is impossible, so the adapter aborts hard rather than returning a guess. Distinguish from cloud drivers (S3, R2) which always support temporary URLs.
Source
Thrown at src/Illuminate/Filesystem/LocalFilesystemAdapter.php:77
* Get a temporary URL for the file at the given path.
*
* @param string $path
* @param \DateTimeInterface $expiration
* @param array $options
* @return string
*
* @throws \RuntimeException
*/
public function temporaryUrl($path, $expiration, array $options = [])
{
if ($this->temporaryUrlCallback) {
return $this->temporaryUrlCallback->bindTo($this, static::class)(
$path, $expiration, $options
);
}
if (! $this->providesTemporaryUrls()) {
throw new RuntimeException('This driver does not support creating temporary URLs.');
}
$url = call_user_func($this->urlGeneratorResolver);
return $url->to($url->temporarySignedRoute(
'storage.'.$this->disk,
$expiration,
['path' => strtr(rawurlencode($path), ['%2F' => '/'])],
absolute: false
));
}
/**
* Get a temporary upload URL for the file at the given path.
*
* @param string $path
* @param \DateTimeInterface $expiration
* @param array $optionsView on GitHub (pinned to bd6b5437e6)
Solutions
- Switch the disk to an S3-compatible driver (s3, that supports temporary URLs) for the environments that need presigned links.
- Guard the call: if (Storage::disk($disk)->providesTemporaryUrls()) { ... } before generating the URL.
- Register a custom temporary-URL builder on the local disk via Storage::disk('local')->buildTemporaryUrlsUsing(fn ($path, $expiration, $options) => route('local.signed', ...)).
- Enable signed-URL serving for the local disk if your app exposes a controller that serves the file from the signed route.
- For downloads, fall back to a normal asset/signed-route URL or stream the file directly instead of requesting a temporary URL.
Example fix
// before
$url = Storage::disk('local')->temporaryUrl('files/report.pdf', now()->addMinutes(5));
// after
use Illuminate\Support\Facades\Storage;
$disk = Storage::disk('local');
if ($disk->providesTemporaryUrls()) {
$url = $disk->temporaryUrl('files/report.pdf', now()->addMinutes(5));
} else {
// Fallback: signed route served by your own controller
$url = URL::temporarySignedRoute('files.download', now()->addMinutes(5), ['path' => 'files/report.pdf']);
} Defensive patterns
Strategy: validation
Validate before calling
use Illuminate\Support\Facades\Storage;
$disk = Storage::disk('local');
if (! $disk->providesTemporaryUrls()) {
// do not call temporaryUrl(); fall back to a signed route or asset URL
abort(501, 'Temporary URLs are not supported on this disk.');
} Type guard
function supportsTemporaryUrls(string $diskName): bool {
return Storage::disk($diskName)->providesTemporaryUrls();
} Try / catch
use Illuminate\Filesystem\FilesystemAdapter;
try {
$url = Storage::disk($disk)->temporaryUrl($path, $expiration);
} catch (\RuntimeException $e) {
if (str_contains($e->getMessage(), 'does not support creating temporary URLs')) {
// fall back to a signed route / direct stream
}
throw $e;
} Prevention
- Always call providesTemporaryUrls() before temporaryUrl() when the disk is configurable.
- Pin disk choice by environment: use s3/r2 disks for presigned links, local for streaming.
- Centralize URL generation behind a service that knows each disk's capability.
When it happens
Trigger: Calling Storage::disk('local')->temporaryUrl($path, Carbon::now()->addMinutes(5)) on a disk whose driver is 'local' and where no temporaryUrlCallback was set with Storage::disk('local')->buildTemporaryUrlsUsing(...). Also reached indirectly via any package that calls temporaryUrl() (e.g. medialibrary, some download-link helpers) against a local disk.
Common situations: Copy-pasting S3 presigned-link code onto the default 'local' disk during local development. Using the same Storage facade calls across environments where production uses s3 but staging uses local. Running tests against a local disk while the code assumes S3 semantics. A package that requires temporary URLs being pointed at a local disk.
Related errors
- This driver does not support creating temporary upload URLs.
- File does not exist at path {$path}.
- This driver does not support creating temporary URLs.
- Database file at path [{$path}] does not exist. Ensure this
- To enable support for relative links, please install the sym
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/700b5f8e47a4ee76.json.
Report an issue: GitHub.