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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Nov 15, 2007 10:13 AM, Per Jessen <per@xxxxxxxxxxxx> wrote:
> 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
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

    I would actually make a slight modification to Per's code and
place the header(); information post-processing the data.  Otherwise
you won't be able to properly display errors in the event of a
failure.


-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux