Re: attachment problem
| From: | Lars Olsson | Date: | Mon, 13 Jan 2003 21:15:08 +0000 |
| Subject: | Re: attachment problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131475@lists.php.net to get a copy of this message | ||
Yes, I've tried using the Content-Disposition header. It doesn't seem to work...here are the relevant parts of my code:
<snip>
// Change Content-Type so that it matches the MIME-type of the part
header('Content-Type: ' . $type . '/' . $subtype);
// Check if there is a name for the part
if (isset($name)) {
header('Content-Disposition: inline; filename=' . $name);
}
else {
header('Content-Disposition: inline');
}
</snip>
I've tried printing $type, $subtype and $name and they all contain correct values...still no luck.
As per your suggestion I tried using wget -S to check the headers. Here are the results:
C:\WINDOWS\Profiles\Lasso\Skrivbordet>wget -S --spider http://localhost/webmail/
attachment.php?mailbox=INBOX&msguid=279&part=2
--21:59:30-- http://localhost/webmail/attachment.php?mailbox=INBOX&msguid=279&p
art=2
=> `attachment.php@mailbox=INBOX&msguid=279&part=2'Resolving localhost... done. Connecting to localhost[127.0.0.1]:80... connected. HTTP request sent, awaiting response... 1 HTTP/1.1 200 OK 2 Date: Mon, 13 Jan 2003 20:59:39 GMT 3 Server: Apache/1.3.27 (Win32) PHP/4.2.3 4 X-Powered-By: PHP/4.2.3 5 Set-Cookie: PHPSESSID=12ab68cb5cd7355b2a63b9007bda0221; path=/ 6 Expires: Thu, 19 Nov 1981 08:52:00 GMT 7 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 8 Pragma: no-cache 9 Keep-Alive: timeout=15, max=100 10 Connection: Keep-Alive 11 Content-Type: text/html 200 OK I'm VERY confused about line 11! The type (for this particular request) should be image/bmp (Mozillas Page Info tab confirms this). Still, wget claims it is text/html...hm...strange...now what? /Lars Olsson (lasso@lassoweb.nu) Timothy Hitchens ) wrote:
So you have tried as per the manual: header("Content-Disposition: attachment; filename=downloaded.pdf"); I use this all the time without issue.. do you have a shell that you can use to "wget -S" and see if the correct headers are coming out?? Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: tim@hitcho.com.au