...

View Full Version : zip a file and stream



xhunter
05-11-2008, 09:08 PM
I have my own script that get the content of a file and streams it and it also supports ranges requests providing resuming possibility for the downloads.

this is how the file is opened and with fseek it can support resume:



$fp=fopen($filepath,"rb");
fseek($fp,$first);
while(!feof($fp)){
set_time_limit(0);
print(fread($fp,1024*8));
flush();
ob_flush();
}
fclose($fp);


Now what I want is to use this script (http://www.devco.net/archives/2005/05/24/creating_zip_files_with_php.php) to first put the content of the file into a zip file and then stream that zip file. (the only script that I found which supports writing zip files)


here where I have no idea what to do,

the content returned is the zip file content in a variable, but how can stream that, or more specifically, I want to be able use fseek to provide Resume support.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum