Welcome Guest, Not a member yet? Register   Sign In
ZIP Download, not getting all the files in the zip
#1

[eluser]Xenon Design[/eluser]
This is a bit of an odd one.

Heres the code, i'll explain below:
Code:
$rooturl = $this->config->item("base_url");
foreach($items as $idx => $item){
    $data = $this->gallery->get_photo_data(0, $item);
    if($type == "web"){
        $filename = $data['filename']."_web.jpg";
    }else{
        $filename = $data['filename'].".jpg";
    }
    $files['photo_'.$data['photoid'].'.jpg'] = addslashes(file_get_contents($rooturl."static/photos/".$filename));
}

$this->zip->add_data($files);

$this->zip->download('photos_'.time().'.zip');

That's a cut down part of the code but thats all the main parts. The thing is only 10 of 12 of these images are downloading and showing in the ZIP. I added in addslashes() to it to make sure it wasnt fooling with the array, it does the same regardless of wether its there or not. The ZIP downloads fine and unzips ok but there are just less images than there should be. The files that they grab are ok and I have var_dump'd the $file array and everything is there...including the missing images.

Dont worry about if you cant see where $items or $type is from...its in the actual code.

Any suggestions or things in my code that are wrong?


Thanks Big Grin
#2

[eluser]Xenon Design[/eluser]
Im sorry all...i had a big n00b mistake in one of my libs. Its always one thing or the other...ohh well.

Have a good day Smile
#3

[eluser]Derek Allard[/eluser]
LOL, hey Ecky, we've all been there. Glad you got it sorted out Wink




Theme © iAndrew 2016 - Forum software by © MyBB