RE: [PHP] Useful function for file download (i.e. MP3)

From: Date: Tue, 21 Nov 2006 19:26:55 +0000
Subject: RE: [PHP] Useful function for file download (i.e. MP3)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-244983@lists.php.net to get a copy of this message
> I think it will use 1M... > > > function readfile_chunked($filename,$retbytes=true) { > > $chunksize = 1*(1024*1024); // how many bytes per chunk > > :-) Yes 1M is what I meant, although you can set it to whatever you want. > The multiple calls to ob_flush() within the body of the loop are > probably not a Good Idea, as a general rule... I think you missed the point of the function. > flush() is also probably overkill, really, for any file big enough for > this function to be desirable in the first place... Php.net says "flush() has no effect on the buffering scheme of your webserver or the browser on the client side. Thus you need to call both ob_flush() and flush() to flush the output buffers. " http://us3.php.net/flush

« previous php.general (#244983) next »