Downloading movies / forcing download
| From: | Ryan S | Date: | Tue, 27 May 2008 03:57:00 +0000 |
| Subject: | Downloading movies / forcing download | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-274712@lists.php.net to get a copy of this message | ||
Hey!
Heres my requirment, the movie clips are below the root and after the member pays for access the
client want to let the user download the flick and add the sitename to the flicks filename (for
example if the filename is a.avi it should download as test-a.avi)
heres the code i haev come up with so far... the download box pops up in FF but in IE it gives me
the website cannot be found error
======================= code =========================
<?php
$directory_path ="C:\\xampp2\\htdocs\\";
$file_name="Fitna[English].avi";
$file_to_download=$directory_path.$file_name;
$user_agent = strtolower ($_SERVER["HTTP_USER_AGENT"]);
header( "Content-type: application/force-download" );
if ((is_integer (strpos($user_agent, "msie"))) && (is_integer (strpos($user_agent,
"win"))))
{header( "Content-Disposition: filename="."test-".$file_name);
}else{header( "Content-Disposition: attachment; filename="."test-".$file_name);
}
header( "Content-Description: File Transfert");
@readfile($file_to_download);
?>done!
========================================================
Any suggestions as to how i can improve the code and also how to get the above to work?
Thanks in advance!
R
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)