Downloading multiple images using PHP while
<p>The query returns 71 rows but only one image is downloaded. All image files are jpegs with 2 MB maximum file size; most are less than 1 MB. The fsize lines are commented out because they fail to return on the jpg image file.</p>

<p>I have no trouble opening the one image downloaded so I'm doing something right. How can I get the other 70 images? I'm not deep in PHP but I get done what I need to get done. Here's my code:</p>

<pre><code>    &lt;?php

    $query = "SELECT imagefilename FROM imageinfo WHERE accepted = 1 ";
    $result = mysqli_query($connect, $query);
    while ($row = mysqli_fetch_array($result))
    {
        $imagefilename = $row[0];

        $sourcefile = 'http://domain.com/images/'.$imagefilename;

        if ($fd = fopen ($fullPath, "r"))
        {
                //$fsize = filesize($sourcefile);

                // if IE, otherwise Content-Disposition ignored
                if(ini_get('zlib.output_compression'))
                    ini_set('zlib.output_compression', 'Off');

                header("Content-type: image/jpg");
                header("Content-Disposition: attachment; filename=$imagefilename");
                //header("Content-length: $fsize");
                header("Cache-control: private");
                while(!feof($fd))
                {
                    $buffer = fread($fd, 2097152);
                    echo $buffer;
                }
        }
        fclose ($fd);
    } //end while
    ?&gt;
</code></pre>