<?php
if ($_GET['action']=="down")
{
$file=end(explode("/",$_GET['path']));
$type=end(explode(".",$file));
header('Content-type: image/'.$type);
header('Content-Disposition: attachment; filename='.$file);
readfile($file);
}
?>
<script type="text/javascript">
<!--
function GoUrl(url)
{
var php=confirm("下载按确定,浏览按取消")
if (php==true)
{
location.href="test.php?action=down&path="+url;
}
else
{
location.href=url;
}
}
//-->
</script>
<a href="chonglang.gif" ><img src="chonglang.gif" alt="surfchen" /></a>