Groups | Blog | Home
all groups > macromedia flash sitedesign > november 2005 >

macromedia flash sitedesign : Download file when you click on button



Dilroy
11/29/2005 12:58:16 AM
Hi there, I'm trying to assign a button on my site to download a mov. file when
you click on it as opposed to loading and playing the mov. in the browser
window.

Does anyone know how this is achieved?
Jean Christophe Avard
11/30/2005 11:42:53 AM
I think you could do this using PHP and LoadVars.

open notepad, paste this code in it, save the file as download.php
replace $filename and $path

then use loadVars in flash to load download.php and it should work.
hth, jcavard from www.neta.ca/en
<?
header('Pragma: private');
header('Cache-control: private, must-revalidate');
header("Content-type: text/x-ms-iqy");

$filename = "filename.mov";
$path = "/www/path/to/vid/";

$fp = fopen($path.$filename,"r");
$filedata=fread($fp,filesize($path.$filename));

fclose($fp);
header("Content-type: text/x-ms-iqy");
header("Content-Disposition: attachment; filename=".$filename);
print $filedata;
?>

[quoted text, click to view]

AddThis Social Bookmark Button