Re: [PHP] Setting the name of a file in a download....

2002-04-23 Thread Richard Archer

At 3:59 PM +1000 23/4/02, Brian White wrote:

Is there any way to get it to save as a file called file.zip?
Is there any header I can set? The headers it currently returns

header(Content-type: application/octet-stream; name=\file.zip\);
header(Content-Disposition: attachment; filename=\file.zip\);
header(Content-transfer-encoding: binary);

 ...R.

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




[PHP] Setting the name of a file in a download....

2002-04-22 Thread Brian White

I am using the following code to create a downloader. It works, except
that IE will just dump the contents to it's browser and Netscape 4
asks if I want to save it in a file called blah.php.


 // File: blah.php

 if ( ! $fp = fsockopen (www.steptwo.com.au, 80, $errno, $errstr, 30) )
 {
 echo $errstr ($errno)br\n;
 }
 else
 {
 $userpass = user:password;
 fputs ($fp, GET /files/file.zip HTTP/1.0\r\n .
 Host: www.steptwo.com.au\r\n .
 Authorization: Basic  . base64_encode( $userpass ) . 
\r\n .
 \r\n);

 while ( $headerStr = trim( fgets( $fp , 3072 ) ) )
 {
 if ( strpos( $headerStr, : ) )
 header( $headerStr );
 }


 fpassthru( $fp );
 }

Is there any way to get it to save as a file called file.zip?
Is there any header I can set? The headers it currently returns
are:

Date: Tue, 23 Apr 2002 06:02:36 GMT
Server: Apache/1.3.12 (Unix) ApacheJServ/1.1.2 PHP/4.0.1pl2 
FrontPage/4.0.4.3 mod_ssl/2.6.6 OpenSSL/0.9.5a
Last-Modified: Tue, 23 Apr 2002 05:13:07 GMT
ETag: 61b3e-ba-3cc4ed63
Accept-Ranges: bytes
Content-Length: 186
Connection: close
Content-Type: application/zip

regs

Brian White
-
Brian White
Step Two Designs Pty Ltd
Knowledge Management Consultancy, SGML  XML
Phone: +612-93197901
Web:   http://www.steptwo.com.au/
Email: [EMAIL PROTECTED]



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