Download Dialog Window
Posted: Mon Oct 11, 2004 6:13 pm
feyd | Help us, help you. Please use
figured it out
feyd | Help us, help you. Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I had found a script on the web a few months back, but don't know how to implement it. It is suppose to pop-up the Download Dialog Window (Open/Save As options) when a visitor to my site clicks on one of the downloadable videos. I have the following code in a file called download.php and was wondering what I need to put on the index page to call that code. Thanks.Code: Select all
<?php
if ($_REQUEST ['getfile']){
$file = $_REQUEST ['getfile'];
} else {
$file = "..";
}
if(strstr($file, "..")){
Header( "Content-Type: text/html");
echo ('
<html><head><title>Error</title></head><body>
<h3>Invalid characters in filename.</h3>
</body></html>
');
} else if(!file_exists($file) || !is_readable($file)){
Header ("Content-Type: text/html");
echo ('
<html><head><title>Error</title></head><body>
<h3>The file you requested does not exist.</h3>
</body></html>
');
} else {
Header ("Content-Type: audio/wma");
Header ("Content-Length: ".filesize($file));
Header ("Content-Disposition: attachment; filename=$file");
Header ("Content-Description: Windows Media Audio File");
readfile($file);
}
?>figured it out
feyd | Help us, help you. Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]