Re: smart auto download file

From: Date: Tue, 31 May 2011 20:09:11 +0000
Subject: Re: smart auto download file
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-313283@lists.php.net to get a copy of this message
On Wed, 1 Jun 2011, Ali Asghar Toraby Parizy wrote:
I need to tell something to the user before starting download. something like "Your download will begin in a moment..." . So header couldn't help me. If I try to echo anything header doesn't work!
Couldn't you just do an HTML redirect?
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <html>
      <head>
      <title>File Download</title>
      <meta http-equiv="REFRESH"
      content="10;url=http://www.example.net/download"></HEAD>
      <BODY>
      <P>Your download will start in a few seconds.</P>
      <P>If your download fails to start automatically,
      <A HREF="http://www.example.net/download">click here</A>.</P>
      </BODY>
      </HTML>
Of course, this is the resulting HTML you want to produce (or something like it). You'll obviously get PHP to echo the appropriate URL. This approach has the benefit that it'll work on anything. My prefered browser does not support javascript, so you look me out of your site if you use it. Geoff.

« previous php.general (#313283) next »