mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
Laravel Vapor - sync code for download files in bulk from S3 to more files
This commit is contained in:
+5
-20
@@ -73,27 +73,12 @@ class BulkDownloadSupplierWhiteFormsLogic
|
||||
|
||||
Log::info('BulkDownloadSupplierWhiteFormsLogic finished processing files count: '.count($groups));
|
||||
|
||||
// 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);
|
||||
$temporaryUrl = Storage::disk('s3')->temporaryUrl(
|
||||
$filePathForS3,
|
||||
Carbon::now()->addMinutes(60)
|
||||
);
|
||||
|
||||
return response()->stream(function () use ($filePathForS3) {
|
||||
$temporaryUrl = Storage::disk('s3')->temporaryUrl(
|
||||
$filePathForS3,
|
||||
Carbon::now()->addMinutes(60)
|
||||
);
|
||||
$fileStream = fopen($temporaryUrl, 'r');
|
||||
fpassthru($fileStream);
|
||||
fclose($fileStream);
|
||||
}, 200, [
|
||||
'Content-Type' => 'application/octet-stream',
|
||||
'Content-Disposition' => 'attachment',
|
||||
]);
|
||||
return response(['src' => $temporaryUrl ]);
|
||||
}
|
||||
else {
|
||||
return response()->json([
|
||||
|
||||
+10
-4
@@ -88,10 +88,16 @@
|
||||
},
|
||||
successHandler(response) {
|
||||
this.isLoading = false;
|
||||
if (response.message) {
|
||||
this.returnData = response;
|
||||
} else {
|
||||
this.returnData = null;
|
||||
if(window.LARAVEL_VAPOR_ENABLED){
|
||||
let src = response.payload.src;
|
||||
window.location.href = src;
|
||||
}
|
||||
else{
|
||||
if (response.message) {
|
||||
this.returnData = response;
|
||||
} else {
|
||||
this.returnData = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
hasMarkingParameter() {
|
||||
|
||||
Reference in New Issue
Block a user