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 I must download, 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;
While the file is small, the above code will not be a problem, but when I need to download a large file, I get errors and etc... The page takes longer to load (much more) and then the user still has to wait for the download, making it useless. Once I intend to call such a page through a request AJAX
, what are the solutions I can use? And how can I get information like how much longer for the file to finish downloading and etc..
certainly in the API returns should contain the information, vc would have the link for me to take a look at the documentation of the api?
– Wees Smith
This is the Google Drive API, https://developers.google.com/drive/v3/web/manage-downloads
– Leo Letto