{"id":"eb659a9cc068637f","repo":"laravel/framework","slug":"this-driver-does-not-support-creating-temporary-ur","errorCode":null,"errorMessage":"This driver does not support creating temporary URLs.","messagePattern":"This driver does not support creating temporary URLs\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Filesystem/FilesystemAdapter.php","lineNumber":883,"sourceCode":"     * @param  \\DateTimeInterface  $expiration\n     * @param  array  $options\n     * @return string\n     *\n     * @throws \\RuntimeException\n     */\n    public function temporaryUrl($path, $expiration, array $options = [])\n    {\n        if (method_exists($this->adapter, 'getTemporaryUrl')) {\n            return $this->adapter->getTemporaryUrl($path, $expiration, $options);\n        }\n\n        if ($this->temporaryUrlCallback) {\n            return $this->temporaryUrlCallback->bindTo($this, static::class)(\n                $path, $expiration, $options\n            );\n        }\n\n        throw new RuntimeException('This driver does not support creating temporary URLs.');\n    }\n\n    /**\n     * Get a temporary upload URL for the file at the given path.\n     *\n     * @param  string  $path\n     * @param  \\DateTimeInterface  $expiration\n     * @param  array  $options\n     * @return array\n     *\n     * @throws \\RuntimeException\n     */\n    public function temporaryUploadUrl($path, $expiration, array $options = [])\n    {\n        if (method_exists($this->adapter, 'temporaryUploadUrl')) {\n            return $this->adapter->temporaryUploadUrl($path, $expiration, $options);\n        }\n","sourceCodeStart":865,"sourceCodeEnd":901,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Filesystem/FilesystemAdapter.php#L865-L901","documentation":"Thrown by FilesystemAdapter::temporaryUrl() when the adapter has no getTemporaryUrl() method and no temporaryUrlCallback was registered. Temporary (pre-signed) URLs are only meaningful for cloud stores like S3; the call fails fast for adapters that cannot produce them.","triggerScenarios":"Calling Storage::disk($name)->temporaryUrl($path, $expiration) on a disk whose adapter lacks getTemporaryUrl (e.g. local, ftp, sftp, or a custom adapter) and where buildTemporaryUrlsUsing() was not called.","commonSituations":"Calling temporaryUrl() on a local disk in tests; using a generic adapter without pre-signed URL support; forgetting to register a callback for a custom cloud adapter.","solutions":["Use an S3 (or other cloud) disk that supports pre-signed URLs.","Register a builder: Storage::disk('custom')->buildTemporaryUrlsUsing(fn($path,$exp,$opts) => ...).","Guard with $disk->providesTemporaryUrls() before calling temporaryUrl().","For local disks, generate a signed URL via a route + middleware instead."],"exampleFix":"// before - local disk cannot issue temporary urls\n$url = Storage::disk('local')->temporaryUrl('file.txt', now()->addMinutes(5));\n\n// after\nif (Storage::disk('local')->providesTemporaryUrls()) {\n    $url = Storage::disk('local')->temporaryUrl('file.txt', now()->addMinutes(5));\n} else {\n    // route-based signed url fallback\n    $url = URL::temporarySignedRoute('file.show', now()->addMinutes(5), ['path' => 'file.txt']);\n}","handlingStrategy":"validation","validationCode":"$disk = Storage::disk($name);\nif (! $disk->providesTemporaryUrls()) {\n    // no presigned url support - route-based signed url fallback\n    return URL::temporarySignedRoute('file.show', $expiration, ['path' => $path]);\n}\nreturn $disk->temporaryUrl($path, $expiration);","typeGuard":"function diskSupportsTemporaryUrls(\\Illuminate\\Filesystem\\FilesystemAdapter $disk): bool\n{\n    return $disk->providesTemporaryUrls();\n}","tryCatchPattern":"try {\n    return Storage::disk($name)->temporaryUrl($path, $expiration);\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'temporary URLs')) {\n        // fallback: signed route or 404\n        return URL::temporarySignedRoute('file.show', $expiration, ['path' => $path]);\n    }\n    throw $e;\n}","preventionTips":["Guard with providesTemporaryUrls() before calling temporaryUrl().","Use S3/cloud disks where presigned URLs are required.","Register buildTemporaryUrlsUsing() for custom adapters."],"tags":["filesystem","flysystem","temporary-url","adapter","pre-signed"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}