Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't download files from Dropbox since upgrading to Laravel 10, but all other functions work fine #98

Open
krismanning opened this issue Oct 10, 2024 · 1 comment

Comments

@krismanning
Copy link

Hi folks,

Hope you can help me with this. I'm currenly upgrading a Laravel application from version 9 to version 11.

The app has functionality that allows to upload files to Dropbox, create folders, delete files and folders and of course to download files as well.

I took the upgrade in stages but the moment I went to Laravel 10 I could no longer download the files from dropbox, but all the other functions (create folders, jupload, delete files and folders) still work fine.

The browser throws this error:Image

The code looks like this....

        if (Storage::disk('dropbox')->exists($filename)) {

            Log::channel('daily')->info('File downloaded', [
                'file' => $filename,
                'user' => Auth::user()->name,
            ]);
            
            return Storage::disk('dropbox')->download($filename);
        }

The 'exists' check works fine. But the download doesn't and the browser throws an error. It worked fine in Laravel 9 but fails the moment I upgrade to version 10.

Storage::url works fine as well and returns a working URL for the file. Its just the download that doesnt Do I need to apply a header in the download call maybe?

Any ideas what it could be?

Thanks,

Kris

@krismanning
Copy link
Author

Just to add, I have temporarily solved my problem by doing this (I know it could be a single line), it works fine but I'd prefer the download function.

 $url = Storage::disk('dropbox')->url($filename);
 return redirect($url);

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

No branches or pull requests

1 participant