© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•15mo ago•
59 replies
Matthew

Cant download file from storage

I have created a file in a directory using makeDirectroy(). Then Im trying to download it using storage::download(), response->file(), response->download(), I ALSO tried using controller but none of them are working either... Im very stuck and confused...
I have a private storage if you're wondering
public function downloadDocument()
    {
        // setting variables

        if (! $storage->exists($recordID . '/compiled')) {
            $storage->makeDirectory($recordID . '/compiled');
        }

        // Build the command
        $command = [
          // ...
        ];

        // Execute the command using Symfony Process
        $process = new Process($command);
        $process->setTimeout(30);

        try {
            $process->mustRun();
        } catch (ProcessFailedException $exception) {
            throw new RuntimeException('compilation failed: ' . $exception->getMessage());
        }

        $pdfPath = $recordID . '/compiled/main.pdf';

        if (! $storage->exists($pdfPath)) {
            throw new RuntimeException('PDF file does not exist after compilation.');
        }

        return Storage::download($pdfPath);
    }
public function downloadDocument()
    {
        // setting variables

        if (! $storage->exists($recordID . '/compiled')) {
            $storage->makeDirectory($recordID . '/compiled');
        }

        // Build the command
        $command = [
          // ...
        ];

        // Execute the command using Symfony Process
        $process = new Process($command);
        $process->setTimeout(30);

        try {
            $process->mustRun();
        } catch (ProcessFailedException $exception) {
            throw new RuntimeException('compilation failed: ' . $exception->getMessage());
        }

        $pdfPath = $recordID . '/compiled/main.pdf';

        if (! $storage->exists($pdfPath)) {
            throw new RuntimeException('PDF file does not exist after compilation.');
        }

        return Storage::download($pdfPath);
    }

Does it have to do with permissions or something?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Next page

Similar Threads

FileUpload download/preview file from private storage
FilamentFFilament / ❓┊help
3y ago
download file from view page
FilamentFFilament / ❓┊help
3y ago
File download problem
FilamentFFilament / ❓┊help
3y ago
Delete avatar image file from local storage
FilamentFFilament / ❓┊help
3y ago