Hello
I've got some swf files linked to my website, and currently, when clicking on the link, it opens the content in a new window, however I want to make the file downloadable when the link is clicked, how to do this?

You could instruct your users to "right click and select save on disk" or something like that. If that's not what you want, there are some headers you can use for this. Copied from http://elouai.com/force-download.php:

header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers 
header("Content-Type: application/force-download"); // or application/x-shockwave-flash, I don't know which works better
// change, added quotes to allow spaces in filenames, by Rajkumar Singh
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" ); // filename should come here
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename)); // ... and the size.

To make it easier, you could just create a php page that does this (instead of converting this to .htaccess or something like that stuff), but that's kinda up to you.

managed to make it work using

<?php
$file = $_GET['file'];
header ("Content-type: octet/stream");
header ("Content-disposition: attachment; filename=".$file.";");
header("Content-Length: ".filesize($file));
readfile($file);
exit;
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.