|
|
|
|
|
|
![]() |
#1 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
![]() Is there something I can do with htaccess or something to force a movie to download instead of being viewed in the browser or being streamed to a player?
|
![]() |
![]() |
![]() |
#2 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
I believe to do this you need to alter the content type of the file being served which requires a handler of sorts to do this which can then be hidden with an .htaccess. It will use more cpu than letting apache serve the file.
Code:
<?php header("Content-Type: video/x-ms-wmv"); header('Content-Disposition: attachment; filename="test.wmv"'); $file=fopen("test.wmv","rb"); fpassthru($file); close($file); ?>
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#3 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
It's for inside of member's area. Right now the members are told to right mouse click but this seems too complicated for some of them based on help emails.
The mp4 movies can be viewed in the browser but then there are also links to download the mp4 movies plus the m4v and wmv file. Screen shot |
![]() |
![]() |
![]() |
#4 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
I can change around how things are organized but this is how it is being done at the three sites that I manage.
One pic per post so here is the shot of the directory |
![]() |
![]() |
![]() |
#5 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
.htaccess
Code:
RewriteEngine on RewriteRule vids/(.*) /video.php?video=$1 [L] Code:
<?php $filename = "/var/www/domain.com/" . $_REQUEST['video']; if ( (preg_match("/[a-z0-9\-_]+.(mp4|wmv|mp4a)/i",$_REQUEST['video'])) && (file_exists($filename)) ) { header("Content-Type: " . mime_content_type($filename)); header('Content-Disposition: attachment; filename="' . $_REQUEST['video'] . '"'); $file=fopen($filename,"rb"); fpassthru($file); close($file); } else { print "error retrieving file"; } ?>
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#6 |
Subversive filth of the hedonistic decadent West
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
|
That does look exactly like what I'm looking for.
![]() Lets see if I've got this right... I link to the video.php and the video.php calls up the movie that is specified in its server path and if I have four movies then I make four copies of video.php I should change this to this for the 3 movie extensions that I use. Code:
(mp4|wmv|m4v) I'll try it out tomorrow on the Ana site. |
![]() |
![]() |
![]() |
|
|