mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-28 00:43:58 +00:00
Laravel Vapor - sync code for download files in bulk from S3 to more files
This commit is contained in:
+17
-4
@@ -73,14 +73,27 @@ class BulkDownloadSupplierWhiteFormsLogic
|
||||
|
||||
Log::info('BulkDownloadSupplierWhiteFormsLogic finished processing files count: '.count($groups));
|
||||
|
||||
return response()->streamDownload(function () use ($filePathForS3) {
|
||||
// return response()->streamDownload(function () use ($filePathForS3) {
|
||||
// $temporaryUrl = Storage::disk('s3')->temporaryUrl(
|
||||
// $filePathForS3,
|
||||
// Carbon::now()->addMinutes(60)
|
||||
// );
|
||||
// $response = Http::get($temporaryUrl);
|
||||
// echo $response->getBody()->getContents();
|
||||
// }, $zipFileName);
|
||||
|
||||
return response()->stream(function () use ($filePathForS3) {
|
||||
$temporaryUrl = Storage::disk('s3')->temporaryUrl(
|
||||
$filePathForS3,
|
||||
Carbon::now()->addMinutes(60)
|
||||
);
|
||||
$response = Http::get($temporaryUrl);
|
||||
echo $response->getBody()->getContents();
|
||||
}, $zipFileName);
|
||||
$fileStream = fopen($temporaryUrl, 'r');
|
||||
fpassthru($fileStream);
|
||||
fclose($fileStream);
|
||||
}, 200, [
|
||||
'Content-Type' => 'application/octet-stream',
|
||||
'Content-Disposition' => 'attachment',
|
||||
]);
|
||||
}
|
||||
else {
|
||||
return response()->json([
|
||||
|
||||
Reference in New Issue
Block a user