Using Header to sort of redirect a URL to an audio file to be used as a BGSound
| From: | Jacob Kruger | Date: | Wed, 03 Mar 2010 15:19:14 +0000 |
| Subject: | Using Header to sort of redirect a URL to an audio file to be used as a BGSound | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-29945@lists.php.net to get a copy of this message | ||
FWIW, and might be minorly interesting, but in order to use something like the following HTML tag in a page to play a sound in the background, but without actually allowing them to see the actual file name to prevent the file from being directly downloaded:
<bgsound src="sndsrc.php" loop="1" />
Then in the sndsrc.php file:
//wav = "audio/x-wav"
//mp3 = "audio/mpeg"
$PhysicalFileName = "realsource.wav";
header('HTTP/1.1 200 OK', True, 200);
header('Content-Description: File Transfer');
header('Content-Type: audio/x-wav');
header('Content-Disposition: attachment; filename="redirected.wav"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($PhysicalFileName));
readfile($PhysicalFileName);
Suppose it would let you then at the very least double check session usage, or maybe check requesting URL or something to then block them from downloading the file directly as such.
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4911 (20100303) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4912 (20100303) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com