Then you're getting exactly what you should be getting.  fopen will read
the text file as it appears on *disk* not what the output on your browser
is.....

??

-philip

On Wed, 11 Dec 2002, Colin Bossen wrote:

> I add mention that the contents of the download.php file are the
> contents of the file I am trying to download...
>
>
> On Wednesday, December 11, 2002, at 06:31 PM, Colin Bossen wrote:
>
> > Opps... $data is set on the download page. It is set like this:
> >
> >     $path .= "export/".$name;
> >     $fp = fopen($path, "rb");
> >     $data = fread($fp, $size);
> >     fclose($fp);
> >
> > Colin
> >
> > On Wednesday, December 11, 2002, at 06:21 PM, Philip Hallstrom wrote:
> >
> >> Where/How do you set $data?  Everything else looks fine, but without
> >> knowing that we can't help much.
> >>
> >> On Wed, 11 Dec 2002, Colin Bossen wrote:
> >>
> >>> Hello:
> >>>
> >>> I am trying to use the header function to enable users to download
> >>> files. I am able to get files to download. Unfortunately, the wrong
> >>> file
> >>> keeps downloading. Instead of downloading the file I want the php
> >>> source
> >>> file is getting downloaded. Here is the posting code:
> >>>
> >>> $output = "<a
> >>> href=\"download.php?name=".$filename."&size=".$size."\">Click here to
> >>> download ".$filename."</a>";
> >>>
> >>> echo $output;
> >>>
> >>> Here is the download code:
> >>>
> >>> <?php
> >>> if ($name) {
> >>>
> >>>           header("Content-type: application/x-macbinary");
> >>>           header("Content-length: $size");
> >>>           header("Content-Disposition: attachment; filename=$name");
> >>>           header("Content-Description: PHP Generated Data");
> >>>           echo $data;
> >>> }
> >>> ?>
> >>>
> >>> Any help anyone might have would be much appreciated.
> >>>
> >>> Colin
> >>>
> >>>
> >>> --
> >>> 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
> >
>
>
> --
> 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