I haven't used headers for this, but heres my $0.02.

What is the value of hte $name var? I suspect its empty, as register_globals
is probaly enabled... try using $_GET['name'] instead of just $name, and
$_GET['size'] instead of $size.

Jason Reid
[EMAIL PROTECTED]
--
AC Host Canada
www.achost.ca

----- Original Message -----
From: "Colin Bossen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 11, 2002 5:17 PM
Subject: [PHP] understanding headers


> 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

Reply via email to