htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Using PHP to force a download?
PostPosted: 02 Oct 2006 02:03 
Offline
User avatar

Joined: 25 Sep 2006 04:48
Posts: 242
My website hosts some small .avi and .mpg video clips, which unfortunately, IE's default configuration decides its best to open in Windows media player, and then "streams" it from the server (I realise this is called HTTP Progressive downloading).. Is there a way for the server, either via .htaccess or php code (perhaps header setting?) to control how the file it to be handled? I'd like to be able to force a click on the link to prompt for download..

Any ideas? Thanks in advance!


Top
 Profile  
 
 Post subject: Use htaccess to force the download
PostPosted: 02 Oct 2006 02:04 
Offline
User avatar

Joined: 25 Sep 2006 04:48
Posts: 242
Yes php is awesome but it is sooo slow.

A much easier, faster, and more efficient way would be to add the following lines to your .htaccess file


Code:
AddType application/octet-stream .avi
AddType application/octet-stream .mpg


Then in your HTML you could just link directly to the file..


Code:
<a href="/movies/mov1.avi">Download Movie1</a>


And then you will get a pop-up box asking whether you want to save the file or open it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB