jmathai / jmathai/s3-bucket-stream-zip-php

Want to run multiple zip download from for loop but closes tab after 1st zip download starts

Open
#7 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
PHP
Stars
56
Forks
15
PR merge metrics
No merged PRs in 30d

Description

How to download multiple zips from for-loop call
below code closes the browser tab when 1st zip download starts so that remaining loops cant work

i.e.
$RowImagesData = array() // in which multiple references are added.
$obj =& get_instance();
$obj->load->library('s3_stream');
$obj->load->library('aws_sdk');
$s3_dir= 'images/';
$bucketname= 'XYZ';

foreach ($RowImagesData as $RIKey => $RIValue)
{
$OrderId = $RIValue['reference']
$path = $s3_dir. $OrderId;
$files = $obj->aws_sdk->listObjects(array('Bucket' => $bucketname, 'MaxKeys' => 1000, 'Prefix' => $path))->getPath('Contents');
if(count($files) > 0)
{
$obj->s3_stream->download($bucketname,$path,$orderid);
}
else
{
echo "alert('Order - $orderid does not exist');";
}
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.