Manual download interface

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
firkinfedup
Forum Newbie
Posts: 19
Joined: Sat Dec 04, 2004 7:25 am

Manual download interface

Post by firkinfedup »

Hi there,

I've got some code that acts as a download interface by sending the relevant headers for the file before sending the file data itself, the code is found all over the place and is nothing special.

I've got a question though regarding the [php_man]header[/php_man] function, how does it work? For example, I can't just simulate the change of header by using [php_man]echo[/php_man] and sending each header part, presumably I am missing a few bytes here and there that are essential.

Does anyone know how to do this manually? If at all possible, so that I could then have a CGI binary initiate the download.

Also, the last line of the download interface is to use [php_man]readfile[/php_man], does this simply read the file into a byte array and [mysql_man]echo[/mysql_man] it to the client all at once? Or is [php_man]readfile[/php_man] a little more intelligent than this?

Thanks LOADS in advance, much appreciation.

Nick.
Post Reply