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) <[EMAIL PROTECTED]>
To: 'Martin' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
>
> > -----Original Message-----
> > From: Martin [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, 22 January 2003 12:50 AM
> > To: [EMAIL PROTECTED]
> > 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
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to