Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

adamnet's avatar

Download file at specific local folder

Is it possible to download a file from the web server at a local folder?

0 likes
6 replies
Glukinho's avatar

https://laravel-news.com/http-sink

This will download the file from $url and put it on local $path in streaming mode, not loading full file to memory:

$url  = 'https://example.com/example-file.zip';
$path = 'folder/download.zip';

Http::sink(Storage::path($path))->get($url);
adamnet's avatar

@Glukinho Correct me if I am wrong: the location in my computer where the downloaded files will be stored, can be defined in the settings of the browser I use. i,e, for Firefoz you have to go to Settings.

Glukinho's avatar

@adamnet do you need to download file to Laravel storage (a directory on a server) or to user's computer? I assumed first.

If you need to download file to user's computer, then why you need Laravel? Just give user an URL and he will download using his browser.

What, where from and where to do you want to download?

Please or to participate in this conversation.