Re: Semi-newbie Question .... streams ...

From: Date: Thu, 15 Nov 2007 15:13:47 +0000
Subject: Re: Semi-newbie Question .... streams ...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-264581@lists.php.net to get a copy of this message
Paul Farr wrote: > The short version is: I need to master the download stream for a > file, while delivering it to the enduser, I need to change some bytes > in the file data. A simple search and replace. I want to do it in the > stream, don't want to create a new file each time. Assuming you've a URL along the lines of this: nnnn.php?file=<filename> nnnn.php: <?php header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"whatever.exe\""); $txt=file_get_contents(the file you want to send) // do your editing on the string here print $txt; ?> /Per Jessen, Zürich

« previous php.general (#264581) next »