Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #14131
| From | Lew Pitcher <lew.pitcher@digitalfreehold.ca> |
|---|---|
| Subject | Re: Generating "download" pages |
| Newsgroups | comp.lang.php |
| References | (2 earlier) <lqeamt$jjv$1@solani.org> <0Jyyv.32646$46.296@fx19.iad> <lqejqg$ksl$1@solani.org> <lqekv2$p4h$1@solani.org> <7WAyv.22266$wR1.4120@fx20.iad> |
| Organization | The Pitcher Digital Freehold |
| Message-ID | <d0Byv.32651$46.29400@fx19.iad> (permalink) |
| Date | 2014-07-19 17:00 -0400 |
On Saturday 19 July 2014 16:54, in comp.lang.php, "Lew Pitcher"
<lew.pitcher@digitalfreehold.ca> wrote:
[snip]
> However, I have found a workaround that will suffice until I determine the
> proper way to get both updated page /and/ download:
>
> The request page (that which I want to update and redisplay) will contain
> within it an (almost) invisible <iframe> linking to a /second/ page. That
> second page will /only/ generate the file transfer headers and file.
>
> Together, the two pages will do what I had hoped to do in one page.
>
> Thanks to all for all the advice.
The main page (sendfile_2.php) looks like this....
<?php
session_start();
$showfile = false;
switch ($_SERVER['REQUEST_METHOD'])
{
case 'GET':
$count = 0;
break;
case 'POST':
$count = 1 + $_SESSION['Count'];
$showfile = (isset($_POST['Action']) && $_POST['Action'] == 'Send');
break;
}
?>
<html>
<head><title>Trial Sendfile</title></head>
<body>
<h1><?php print $count ?></h1>
<p>Did you get it?</p>
<form method="post">
<input type="submit" name="Action" value="Send"/>
</form>
<?php
if ($showfile)
{
?><iframe src="sendfile_2a.php" width="0" height="0" border="0"
frameborder="0" /><?php
}
?>
</body>
</html>
<?php
$_SESSION['Count'] = $count;
?>
The "download helper" page (referenced in the iframe and
called "sendfile_2a.php here) looks like this...
<?php
$file="./SixSpot_d.png";
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize ($file));
readfile($file);
exit(0);
?>
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-18 09:55 -0400
Re: Generating "download" pages Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-18 17:39 +0200
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 11:38 -0400
Re: Generating "download" pages Jerry Stuckle <jstucklex@attglobal.net> - 2014-07-19 16:57 -0400
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 17:06 -0400
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 11:58 -0400
Re: Generating "download" pages Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-19 19:06 +0200
Re: Generating "download" pages "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-07-19 19:43 +0200
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 14:23 -0400
Re: Generating "download" pages "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-07-19 22:18 +0200
Re: Generating "download" pages "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-07-19 22:38 +0200
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 16:54 -0400
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 17:00 -0400
Resolved: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-20 14:34 -0400
Re: Generating "download" pages Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-19 20:50 +0200
Re: Generating "download" pages "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-07-19 22:06 +0200
Re: Generating "download" pages Jerry Stuckle <jstucklex@attglobal.net> - 2014-07-19 16:54 -0400
Re: Generating "download" pages Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-07-20 00:48 +0200
Re: Generating "download" pages Arno Welzel <usenet@arnowelzel.de> - 2014-07-20 01:04 +0200
Re: Generating "download" pages Arno Welzel <usenet@arnowelzel.de> - 2014-07-19 18:17 +0200
Re: Generating "download" pages Jerry Stuckle <jstucklex@attglobal.net> - 2014-07-19 16:55 -0400
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 12:25 -0400
Re: Generating "download" pages Tim Streater <timstreater@greenbee.net> - 2014-07-19 17:36 +0100
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 13:53 -0400
Re: Generating "download" pages Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-07-19 14:14 -0400
Re: Generating "download" pages Curtis Dyer <dyer85@gmail.com> - 2014-07-23 00:38 +0000
csiph-web