People often for get about a little problem that happens with the

<?

$name_the_file = "the name you want the file to be called when prompted to
download";
$file_to_download = "/path/to/file/filename.scp";

// test for internet explorer in the conditional for the following
if..then..else
if (msie) {
  $attachment="";
} else {
  $attachment=" attachment;";
}

header("Content-Type: application/download\n");
header("Content-Disposition:$attachment filename=\"$name_the_file\"");
readfile("$file_to_download");
exit();
?>


I found a bug when developing a download script a year or so ago.

You can't have the 'attachment;' part in IE.  It did some funky stuff

and netscape 4 would die without it.

Jim

----- Original Message -----
From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]>
To: "'Shaun van den Berg'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, January 21, 2003 1:44 AM
Subject: RE: [PHP] DOWNLOAD


> Create a script that reads the contents of a file after sending headers
> eg:
>
> header("Content-type: text/plain");
> header("Content-Disposition: attachment; filename=downloaded.txt");
> readfile("downloaded.txt");
> exit();
>
> The downloaded.txt can be any file subject to sending the correct
> headers and IE
> and other browsers will pop up a download (save) window.
>
> See your mime.types file for headers for each file type.
>
>
> Timothy Hitchens (HiTCHO)
> Open Source Consulting
> e-mail: [EMAIL PROTECTED]
>
> > -----Original Message-----
> > From: Shaun van den Berg [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, 21 January 2003 4:39 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] DOWNLOAD
> >
> >
> > Hi ,
> >
> > Im not sure if this can be done in PHP , i know PHP has
> > upload features ! Does it have download features , wat i mean
> > is the following : i want a link - click here to download -
> > when you click on it , the download dialog box must appear -
> > how do i do this ?
> >
> > Thanks
> >     Shaun van den Berg
> >
> > --
> > Novtel Consulting
> > Tel: +27 21 9822373
> > Fax: +27 21 9815846
> > Please visit our website:
> > www.novtel.co.za
> >
> >
> >
> > --
> > 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