<!-- 鼠标左键直接下载图片 --><iframe id="frame1" style="display:none"></iframe>
<script language="JScript">
var n=0;
function go(url){
n==0?new function(){frames("frame1").location=url,n=1}:null;
document.all("frame1").readyState!="complete"?setTimeout(go,10):so();
function so(){frames("frame1").document.execCommand("SaveAs"),n=0};
}
</script>
<img src="images/title.gif" onclick="go(src)">
<script language="JScript">
var n=0;
function go(url){
n==0?new function(){frames("frame1").location=url,n=1}:null;
document.all("frame1").readyState!="complete"?setTimeout(go,10):so();
function so(){frames("frame1").document.execCommand("SaveAs"),n=0};
}
</script>
<img src="images/title.gif" onclick="go(src)">
//test.php
if($_GET['filePath'] && $_GET['fileName']){
$file = fopen($_GET['filePath'] . $_GET['fileName'],"r"); // 打开文件
// 输入文件标签
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
Header("Accept-Length: ".filesize($_GET['filePath'] . $_GET['fileName']));
Header("Content-Disposition: attachment; filename=" . $_GET['fileName']);
// 输出文件内容
echo fread($file,filesize($_GET['filePath'] . $_GET['fileName']));
fclose($file);
exit;
}?><a href=test.php?filePath=./&fileName=logo.jpg>点击下载</a>
<a href=test.php?filePath=./&fileName=logo.jpg><img src=logo.jpg border=0></a>