Downloading large PHP files?

2

With the following code, I get a file stored in Google Drive:

$response = $service->files->get("id-do-meu-arquivo", array('alt' => 'media'));
$content = $response->getBody()->getContents();

The variable $content , now contains the file that I must download, by changing the headers of the page, the file can be downloaded, for example:

header("Content-type: mimeType");
header("Content-Disposition: attachment; filename = test.formato");
echo $content;

As long as the file is small, the code above will not be a problem, but when I need to download a large file, I get errors and so on ... The page takes more time to load (much more) and then the user still has to wait the download, making it useless. Since I intend to call such a page through a AJAX request, what are the solutions that I can use? And how can I get information like how much is missing for the file to finish downloading and so on ..

    
asked by anonymous 09.05.2018 / 18:24

0 answers