View Single Post
Old 11-09-2011, 11:58 AM  
Bladewire
StraightBro
 
Bladewire's Avatar
 
Industry Role:
Join Date: Aug 2003
Location: Monarch Beach, CA USA
Posts: 56,229
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";
}
?>

This is great THANK YOU!


Before reading your post I came across a recomendation to add this to my .htaccess

AddType application/octet-stream .mp4
<FilesMatch "\.(docx?|txt|mp4?)$">
Header add Content-Disposition "attachment"
</FilesMatch>

So far what this does is allows my jwplayer to play .mp4 files, but when a link with an .mp4 file is clicked, the user is prompted to download the file. So I don't need two copies of the video file.

Do you see any drawback to this? I'm not big on programming and have no idea if this doesn't work for everyone.
__________________


Skype: CallTomNow

Bladewire is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote