Re: How to simultaneously send HTML *and* start download?
| From: | Stuart Dallas | Date: | Tue, 21 May 2002 20:03:51 +0000 |
| Subject: | Re: How to simultaneously send HTML *and* start download? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98646@lists.php.net to get a copy of this message | ||
On 21 May 2002 at 20:37, D. D. Brierton wrote:
> The result I'm looking for is like the CGI script at netscape for
> downloading NS6 - it takes you to a page which says aomething like
> "The download should start automatically" and then the download
> begins. I'm having trouble figuring out how to do this in PHP - I
> suspect through ignorance of the appropriate HTTP headers. Am I
> looking for something like Content-type: multipart? So what I'm
> looking to achieve is a bit like what this obviously fails to do (but
> hopefuly you can see what I'm aiming at):
This is usually done with Javascript...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Download</title>
</head>
<body onLoad="location.href = 'myfile.foo';">
<p>The download should start automatically. If it does not, right
click the following link and choose "Save as ..."</p> <p><a
href="myfile.foo">Download MyFile</a></p>
</body>
</html>
--
Stuart