Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DeepGandhi1602 opened this issue Apr 12, 2018 · 0 comments

Comments

@DeepGandhi1602
Copy link

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 "<script type='text/javascript'>alert('Order - $orderid does not exist');</script>";
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant