Oh, ok.
That can be done only server side, in my case php. There's no way to do it client-side.
The getURL method in ActionScript should read this for example:
-
getURL("download.php?f=path/to/image.jpg");
-
the download.php is the php file that will handle the file to be downloaded, the f=path/to/image.jpg is a variable f being passed in GET method to the donwload.php file, so it will know which file must be used and where it is.
The code in php should be like this:
[PHP]
<?php
$thefile = $_GET['f'];
$ext = substr($thefile ,-3);
if($ext == "jpg") $ext = "jpeg";
header('Content-type: image/' . $ext);
header('Content-Disposition: attachment; filename="' . $thefile . '"');
readfile($thefi le);
?>
[/PHP]
The first line, just catches the f parameter passed through the URL (GET method) and stores it in the $thefile variable.
The second line extracts the last 3 characters -the extension of the file- and stores it in $ext.
Then if the extension is jpg it changes it to jpeg because when we define the content-type, the jpg content-type is image/jpeg, but the rest could be image/gif and image/png if those where the cases.
So then we define the actual content-type, then the content-disposition, that is how will be the content treated as, in this case like an attachment, adn we pass as the filename prameter the file that was passed from flash.
Then we output the file with the read function, that way our php file "becomes" the image to be downloaded.
The browser then will prompt the user to download the file.
Kind regards,
The_Nephilim
Exactly what you said. The images are already viewable by thumbs and by clicking on it I need the download file window to appear in order for the user to get the image. Plz help