Ask a Question related to PHP Development, Design and Development.
-
Magnetotron #1
Problem with forced downloads via HTTP headers..
Hello,
Can anyone verify / solve the problem I am having with downloading an
image..
The following test works fine in every browser I've tried except in mozilla
for windows. Mozilla appends .php to the file name when prompted to save or
open. In IE, I can save it to disk or open it, and the associated program
opens the file. In Mozilla, it can't open the file because it displays the
file like ... somefile.jpg.php
Any ideas why?
<?php
$fpath = "../tmp/";
$fname = "somefile.jpg";
header( "Pragma: no-cache\n" );
header( "Content-type: image/jpg\n" );
header( "Content-Disposition: attachment; filename=\"$fname\"\n" );
header( "Content-transfer-encoding: binary\n" );
header( "Content-length: " . filesize($fpath . $fname) . "\n" );
$fd = fopen($fpath . $fname, 'rb');
while( !feof($fd) )
{
echo fread($fd, 4096);
flush();
}
fclose( $fd );
?>
Magnetotron Guest
-
Http headers...
Hallo, Can't get reed fo http response headers Thow I used response.ClearHeaders wich MSDN say's it should clear all http headers I'm on VS 2005... -
http request headers
I have a proxy which might delete/insert http request headers. I need a way to list the http request headers. How can i do it with perl. TIA, -
HTTP Headers
On 2 Jul 2003 17:51:17 -0700, Jeff Mott <mjeff1@twcny.rr.com> wrote: First of all, Perl does not send HTTP requests. I will assume that you mean... -
#24961 [NEW]: website down for RC2 (http://downloads.php.net/ilia/php-4.3.3RC2.tar.bz2)
From: no at email dot com Operating system: freebsd/mac etc PHP version: 4.3.3RC2 PHP Bug Type: *General Issues Bug... -
Getting all http headers
Hi, I'm just starting out on ASP.NET, although I'm not new to programming. I'm in a crunch and have been all over the documentation and MSDN and... -
Curt Zirzow #2
Re: [PHP] Problem with forced downloads via HTTP headers..
* Thus wrote Magnetotron (magnetotron@hotmail.com):
Should be image/jpeg.> Can anyone verify / solve the problem I am having with downloading an
> image..
>
> <?php
> $fpath = "../tmp/";
> $fname = "somefile.jpg";
>
> header( "Pragma: no-cache\n" );
> header( "Content-type: image/jpg\n" );
Don't know if that is the problem but its worth a shot right now,> header( "Content-Disposition: attachment; filename=\"$fname\"\n" );
mozilla usually is more trusting with reading headers than IE.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
Curt Zirzow Guest
-
Magnetotron #3
Re: [PHP] Problem with forced downloads via HTTP headers..
Ok, I changed it to image/jpeg, and now the filename is....
somefile.jpg.jpeg
No matter what I do, Mozilla for windows wants to append another extension
on the filename based on the mime type. Mozilla under linux works fine...
"Curt Zirzow" <curt@zirzow.dyndns.org> wrote in message
news:20030812010721.GR379@bagend.shire...> * Thus wrote Magnetotron (magnetotron@hotmail.com):>> > Can anyone verify / solve the problem I am having with downloading an
> > image..
> >
> > <?php
> > $fpath = "../tmp/";
> > $fname = "somefile.jpg";
> >
> > header( "Pragma: no-cache\n" );
> > header( "Content-type: image/jpg\n" );
> Should be image/jpeg.
>>> > header( "Content-Disposition: attachment; filename=\"$fname\"\n" );
> Don't know if that is the problem but its worth a shot right now,
> mozilla usually is more trusting with reading headers than IE.
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
Magnetotron Guest



Reply With Quote

