Re: DXF/PHP Problem
| From: | Kevin Stone | Date: | Tue, 15 Apr 2003 21:38:56 +0000 |
| Subject: | Re: DXF/PHP Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144029@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: <Sysadmin@saginawcontrol.com>
To: <php-general@lists.php.net>
Sent: Tuesday, April 15, 2003 3:22 PM
Subject: [PHP] DXF/PHP Problem
> Ok, I'm not sure if this is a PHP problem or Apache problem but I can't
> find any information on it anywhere else and you guys appear to know
> everything. Here it goes. I have a script that I am using on a site
> that allows a person to type in a part number and it will automatically
> redirect them to the corresponding file (DXF) if it exists. The
> problem is, rather letting them download it, IE tries to open the file
> as text. Do I need to put some sort of header in it to keep IE from
> opening it? Please help as I am ripping out my hair. Thanks in
> advance and I apologize if this is off-topic.
>
> Brian
You guessed right about the header..
header("Content-type: application/x-octet-stream");
Then pass the file through stdout. The "accepted" way to do this is with
fopen() and then fpassthru(), but I believe that is only becuase fopen()
supports binary read/write. Other methods to read in and output the
contents of the file will work just as well..
http://www.php.net/manual/en/function.fpassthru.php
HTH,
Kevin