NYCPHP Meetup

NYPHP.org

[nycphp-talk] need help!

haha heli_travel at yahoo.com
Tue Jun 8 10:59:04 EDT 2004


Thanks,  Phil, 
your code is a great help, but it doesn't work for me. I finally
got this, and it works. Thank you for your great help!!

   header("Content-Type: application/vnd.ms-excel;
charset=$dest_charset");
   header("Cache-Control: must-revalidate, post-check=0,
pre-check=0");
   print($report_content);

This code works for both IE and Netscape.

It looks lilke a cach issue.



--- Phillip Powell <phillip.powell at adnet-sys.com> wrote:
> You have to change your headers to force them to download for
> IE as well 
> as for other browsers.  You will need to do more with header()
> to do so:
> 
>     function &generateForceDownloadHeaders($fullFilePath = '')
> {        
>     // STATIC VOID METHOD
>         $file = ($this->fullFilePath) ? $this->fullFilePath :
> $fullFilePath;
>         if (is_file($file)) {
>          $filesize = @filesize($file);
>          header('Content-Disposition: attachment; filename="'
> . 
> substr($file, strrpos($file, '/') + 1, strlen($file)) . '"');
>          header("Content-Length: $filesize");
>          header('Content-Type: application/octet-stream');
>          header('Content-Transfer-Encoding: binary');
>          header('Pragma: no-cache');
>          header('Expires: 0');
>          @readfile($file);
>          @set_time_limit(600);
>         }
>     }
> 
> Phil
> 
> haha wrote:
> 
> >Hi All:
> >
> >Realy no body know about this problem?
> >It works for netscape, but it doesn't work for IE.
> >
> >Thanks again.
> >
> >Bill
> >
> >--- haha <heli_travel at yahoo.com> wrote:
> >  
> >
> >>Hi All:
> >>
> >>I try to program the download program.
> >>I got an very interesting issue:
> >>Here is the code:
> >>
> >>header("Content-Type: application/vnd.ms-excel;
> >>charset=$dest_charset");
> >>print($report_content); 
> >>
> >>But when I download and save ,the save window showed, I
> click
> >>on
> >>"Save",  I got this waired message:
> >>
> >>"
> >>Internet Exploer was not able to open this Internet site.
> The
> >>requested site is either unavailable or cannot be found.
> >>Please
> >>try again later.
> >>"
> >>but if I remove the header:
> >>"header("Content-Type: application/vnd.ms-excel;
> >>charset=$dest_charset");"
> >>
> >>It print out all the contents.
> >>
> >>Please help!
> >>
> >>Thanks,
> >>
> >>Bill
> >>
> >>
> >>
> >>
> >>	
> >>		
> >>__________________________________
> >>Do you Yahoo!?
> >>Friends.  Fun.  Try the all-new Yahoo! Messenger.
> >>http://messenger.yahoo.com/ 
> >>_______________________________________________
> >>talk mailing list
> >>talk at lists.nyphp.org
> >>http://lists.nyphp.org/mailman/listinfo/talk
> >>    
> >>
> >
> >
> >
> >	
> >		
> >__________________________________
> >Do you Yahoo!?
> >Friends.  Fun.  Try the all-new Yahoo! Messenger.
> >http://messenger.yahoo.com/ 
> >_______________________________________________
> >talk mailing list
> >talk at lists.nyphp.org
> >http://lists.nyphp.org/mailman/listinfo/talk
> >
> >  
> >
> 
> 
> -- 
>
---------------------------------------------------------------------------------
> Phil Powell
> Multimedia Programmer
> BPX Technologies, Inc.
> #: (703) 709-7218 x107 
> Fax: (703) 709-7219
> 
> 	
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

>From hans not junk at nyphp.com  Tue Jun  8 11:01:19 2004
Return-Path: <hans not junk at nyphp.com>
Received: from ehost011-1.intermedia.net (ehost011-1.intermedia.net
	[64.78.21.3]) by virtu.nyphp.org (Postfix) with ESMTP id A9BC8A862F
	for <talk at lists.nyphp.org>; Tue,  8 Jun 2004 11:01:19 -0400 (EDT)
X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Subject: RE: [nycphp-talk]Download Error -- need help!
Date: Tue, 8 Jun 2004 08:01:15 -0700
Message-ID: <41EE526EC2D3C74286415780D3BA9F8702704F96 at ehost011-1.exch011.intermedia.net>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: [nycphp-talk]Download Error -- need help!
Thread-Index: AcRM3MUffPhyPuciTPmYJroLz7JpugAjE8+A
From: "Hans Zaunere" <hans not junk at nyphp.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
X-BeenThere: talk at lists.nyphp.org
X-Mailman-Version: 2.1.4
Precedence: list
Reply-To: NYPHP Talk <talk at lists.nyphp.org>
List-Id: NYPHP Talk <talk.lists.nyphp.org>
List-Unsubscribe: <http://lists.nyphp.org/mailman/listinfo/talk>,
	<mailto:talk-request at lists.nyphp.org?subject=unsubscribe>
List-Archive: <http://lists.nyphp.org/pipermail/talk>
List-Post: <mailto:talk at lists.nyphp.org>
List-Help: <mailto:talk-request at lists.nyphp.org?subject=help>
List-Subscribe: <http://lists.nyphp.org/mailman/listinfo/talk>,
	<mailto:talk-request at lists.nyphp.org?subject=subscribe>
X-List-Received-Date: Tue, 08 Jun 2004 15:01:20 -0000



> I try to program the download program.
> I got an very interesting issue:
> Here is the code:
>=20
> header("Content-Type: application/vnd.ms-excel;=20
> charset=3D$dest_charset"); print($report_content);=20
>=20
> But when I download and save ,the save window showed, I click=20
> on "Save",  I got this waired message:
>=20
> "
> Internet Exploer was not able to open this Internet site. The=20
> requested site is either unavailable or cannot be found.=20
> Please try again later.
> "
> but if I remove the header:
> "header("Content-Type: application/vnd.ms-excel;=20
> charset=3D$dest_charset");"
>=20
> It print out all the contents.

It's because Internet Explorer honors the no-cache and no-store pragmas.
This equates to it not wanting to save anything to disk.

When downloading files - in a RFC standard world - you should add some
headers to allow caching/downloading.  Such as

      header('Cache-Control: must-revalidate', TRUE);
      header('Pragma: ', TRUE);

H




More information about the talk mailing list