note 52514 added to function.header
| From: | TJ at osu1 dot php dot net | Date: | Wed, 04 May 2005 10:49:24 +0000 |
| Subject: | note 52514 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88903@lists.php.net to get a copy of this message | ||
I had made a download script for a client that would just register the number of times a document
had been downloaded in a database. When using headers and the readfile()-function to pass the file
through the browser I got some weird errors with half of the powerpoint files I tried to download.
My solution:
- Register the hitcount in the database
- Instead of using headers and readfile, forward the user to the file he/she originally requested
by using the following code:
header("HTTP/1.0 307 Temporary redirect");
echo header("Location: http://www.example.com/filename"); exit();
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52514
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52514&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52514&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52514&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52514&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52514&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52514&report=yes
Search -- http://master.php.net/manage/user-notes.php