Download in .zip file works with website image but not image from Amazon S3 with signed Url <p>I have an object with signed Urls to images on Amazon S3. My example is simplified to one image and my goal is to download a zip file with that image.</p> <p>This image works with my code in the variable <code>$fileUrl</code></p> <blockquote> <p><a href="http://google.com/images/logo.png" rel="nofollow">http://google.com/images/logo.png</a></p> </blockquote> <p>But not this (in variable <code>$fileUrl</code>), I get a corrupt .zip file. I can open the image in the browser with the signed url.</p> <blockquote> <p><a href="https://mybucketname.s3.amazonaws.com/94c70e8a-61f6-4f58-a4b7-1679df5a7c1f.jpg?response-content-disposition=attachment%3B%20filename%3D94c70e8a-61f6-4f58-a4b7-1679df5a7c1f.jpg&amp;AWSAccessKeyId=AKIAJNY3GPOFFLQ&amp;Expires=1426371544&amp;Signature=HDNhGKHDsjEgqkMreN3tbozkfzo%3D" rel="nofollow">https://mybucketname.s3.amazonaws.com/94c70e8a-61f6-4f58-a4b7-1679df5a7c1f.jpg?response-content-disposition=attachment%3B%20filename%3D94c70e8a-61f6-4f58-a4b7-1679df5a7c1f.jpg&amp;AWSAccessKeyId=AKIAJNY3GPOFFLQ&amp;Expires=1426371544&amp;Signature=HDNhGKHDsjEgqkMreN3tbozkfzo%3D</a></p> </blockquote> <pre><code> $zipName = 'zipfile.zip'; # create new zip opbject $zip = new ZipArchive(); $fileUrl = 'https://mybucketname.s3.amazonaws.com/94c70e8a-61f6-4f58-a4b7-1679df5a7c1f.jpg?response-content-disposition=attachment%3B%20filename%3D94c70e8a-61f6-4f58-a4b7-1679df5a7c1f.jpg&amp;AWSAccessKeyId=AKIAJNY3GPOFFLQ&amp;Expires=1426371544&amp;Signature=HDNhGKHDsjEgqkMreN3tbozkfzo%3D'; # create a temp file &amp; open it $tmp_file = tempnam('.',''); $zip-&gt;open($tmp_file, ZipArchive::CREATE); # download file $download_file = file_get_contents($fileUrl); #add it to the zip $zip-&gt;addFromString(basename($fileUrl),$download_file); # close zip $zip-&gt;close(); # send the file to the browser as a download header('Content-type: application/zip'); header('Content-disposition: attachment; filename='.$zipName); header('Content-Length: ' . filesize($tmp_file)); readfile($tmp_file); </code></pre>