summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspiderr <spider@viovio.com>2011-07-29 12:16:38 -0400
committerspiderr <spider@viovio.com>2011-07-29 12:16:38 -0400
commit3e42453ac100cda825299956d91b14a94703719b (patch)
tree5ba44c72b9125812d7a88bc973a5340720ac130e
parentc66736fd82ad48ad24337f5e3cf10870a15f076d (diff)
downloadfisheye-3e42453ac100cda825299956d91b14a94703719b.tar.gz
fisheye-3e42453ac100cda825299956d91b14a94703719b.tar.bz2
fisheye-3e42453ac100cda825299956d91b14a94703719b.zip
add ob_end_flush so large readfile's don't blow PHP memory limits
-rw-r--r--FisheyeGallery.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/FisheyeGallery.php b/FisheyeGallery.php
index ac579d9..84b5f38 100644
--- a/FisheyeGallery.php
+++ b/FisheyeGallery.php
@@ -1020,22 +1020,28 @@ class FisheyeGallery extends FisheyeBase {
$filename = tempnam(TEMP_PKG_PATH,"galleryzip");
$path = '/';
+
if( $zip->open ($filename, ZIPARCHIVE::OVERWRITE) !== TRUE ){
$this->mErrors['download'] = "Unable to create zip file";
}else{
addGalleryRecursive( $this->mGalleryId , $path, $zip);
}
$zip->close();
-
+
//escape backslashes
$outputFileTitle = str_replace("\\",'\\\\',$this->getTitle());
//escape double quotes
$outputFileTitle = str_replace('"','\\"',$outputFileTitle);
- Header("Content-type: application/octet-stream");
+ header('Content-Description: File Transfer');
+ header('Content-Type: application/octet-stream');
Header ("Content-disposition: attachment; filename=\"".$outputFileTitle.".zip\"");
+ header('Content-Transfer-Encoding: binary');
+ header('Expires: 0');
+ header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
+ header('Pragma: public');
Header ("Content-Length: ".filesize( $filename ) );
- Header ("Expires: 0");
+ ob_end_flush();
readfile($filename);
unlink($filename);
}