View Full Version : how to add a download button.

11-04-2010, 06:47 PM
I have the following code, but wish to allow admin members to download the short WMV video without having the page reload.

My page can have anything to to 20 videos on the page.

I can place a button there but how to I get the video files to download and not play when clicked.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style2010.css" rel="stylesheet" type="text/css">

<body style="width:1000px; width: 50%; margin-left: auto; margin-right: auto;">
<div style="width:1000px; padding-right: 3px; padding-left: 3px; height:100%; min-height: 500px;">
<div align="center"><h2>Admin</h2><br /></div>
<div style="float: left; padding-left: 5px;">
<form name="delete" method="post" action="">
<div align="center" style="float: left; padding: 0 10px 50px 10px;">
<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="MediaPlayer1" standby="Loading Windows Media Player components..." width="300" height="300">
<PARAM NAME="url" value="67.wmv" />
<param name="src" value="67.wmv" />
<param name="showcontrols" value="true" />
<param name="autostart" value="false" />
<!--[if !IE]>-->
<object type="video/x-ms-wmv" data="67.wmv" width="300" height="300">
<param name="src" value="67.wmv" />
<param name="autostart" value="false" />
<param name="controller" value="true" />
<br />67.wmv<br />Delete above file? <input name="67---wmv" type="checkbox" value="delete">
<br clear="all"/><input type="submit" name="Delete Selected" value="Delete Selected">
<br /><br />
<br style="clear:both" />


11-05-2010, 11:31 AM
I can place a button there but how to I get the video files to download and not play when clicked. You could add a download link to a page having some server-side script to show the download prompt. Check Example #1 at http://php.net/manual/en/function.header.php to see a PHP snippet.

Major Payne
11-06-2010, 12:16 AM
zip them or...

Forcing File Downloads in PHP: http://elouai.com/force-download.php
Using PHP Headers to Force Download: http://www.ryboe.com/tutorials/php-headers-force-download