Re: download script

From: Date: Tue, 21 Jan 2003 17:46:00 +0000
Subject: Re: download script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-132469@lists.php.net to get a copy of this message
Instead, find out exactly what headers it is that Getright sends. Store the resume point in $resume_bytecount Then, have your script do something like this: /** Send the appropriate HTML headers **/ /** Do this instead of the fpassthru **/ $filesize = size($filename); $fp = fopen('$filename','r'); while ($byte_count < $resume_bytecount) { fread($fp,1); $byte_count = $byte_count + 1; } while(!feof($fp)) { print(read($fp, 8192)); flush(); } Simple, read the file until resume point Then, send the file with an 8k blocksize (standard I believe, change as necessary) Matt ----- Original Message ----- From: Timothy Hitchens (HiTCHO) <hitcho@php.net> To: 'Martin' <martinacevedo@arnet.com.ar>; <php-general@lists.php.net> Sent: Tuesday, January 21, 2003 10:08 AM Subject: RE: [PHP] download script > I have never done a script that supports resume but this is the logic > you need to follow to work out the protocol behaviour. > > - Create a download script as per below start downloading then stop the > web server. > - Change the script to e-mail you the headers from the script request. > - Restart the web server and tell Get Right to resume. > > You should now know what it sends and you simply need to read in the > file to that point > in the data and start the stream again. > > I hope this helps. (Trial and Error) > > > Timothy Hitchens (HiTCHO) > Open Source Consulting > e-mail: tim@hitcho.com.au > > > -----Original Message----- > > From: Martin [mailto:martinacevedo@arnet.com.ar] > > Sent: Wednesday, 22 January 2003 12:50 AM > > To: php-general@lists.php.net > > Subject: [PHP] download script > > > > > > i need a script that make downloads from files but it must > > support resuming for getright and download acelerator pro. > > Thanks... I have this classic download script , but does not > > support resuming > > error_reporting(0); > > header("Last-Modified: " . gmdate("D, d M Y H:i:s T", > > filemtime($filename))); > > header("Accept-Ranges: bytes"); > > header("Content-Length: " . filesize($filename)); > > header("Content-Disposition: attachment; filename=" . > > $download); > > // header("Content-Type: application/octet-stream"); > > readfile($filename); > > header("Connection: close"); > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#132469) next »