View Single Post
Old 11-09-2011, 03:54 PM  
raymor
Confirmed User
 
Join Date: Oct 2002
Posts: 3,745
Quote:
Originally Posted by SmokeyTheBear View Post
you could use htaccess like this in the folder with the videos

Code:
RewriteEngine on
 RewriteRule ^(.*)\.MP4 mp4.php?x=$1 [nc]
this makes all requests for capital letter version "example.MP4" go to a file called mp4.php

Code:
<?php
$x = $_GET['x'];
$file = "$x.mp4";

if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    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($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
} else {
echo "bad request";
}
?>
Do NOT do that in PHP. Similar code in PHP almost always has three major bugs.
Instead set the headers in the .htaccess.
__________________
For historical display only. This information is not current:
support&#64;bettercgi.com ICQ 7208627
Strongbox - The next generation in site security
Throttlebox - The next generation in bandwidth control
Clonebox - Backup and disaster recovery on steroids
raymor is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote