download.php
<?
$file = "./file/Battery.pdf"; // 파일 저장위치
$filename = "Battery.pdf"; // 파일 이름
if ( file_exists($file) )
{
header("Content-Type: doesn/matter");
header("Content-length: ".filesize("$file"));
header("Content-Disposition: attachment; filename=$filename");
header("Content-Transfer-Encoding: binary");
header("Pragma: no-cache");
header("Expires: 0");
if ( is_file("$file") )
{
$fp = fopen("$file", "r");
if ( !fpassthru($fp) )
{
fclose($fp);
}
}
} else
{
echo "<script>alert('첨부파일이 존재하지 않습니다.'); history.go(-1);</script>";
}
?>
-------------------------------------------------------------------------------------------
링크 부분
<map name="Map" id="Map">
<area shape="rect" coords="495,1,609,24" href="download.php?filename=Battery.pdf" target="_self" />
</map>
아주 간단한거입니다. 나중에 함수 만들어서 사용할수도 있고 입맛에 잘 골라 쓰세요.
'PHP' 카테고리의 다른 글
★ php ★ imagebutton 에 이미지 예쁘게 잘 넣기 (0) | 2011.05.08 |
---|---|
★ php ★ 시험도 끝나서 php를 공부하는 중인데, (0) | 2011.05.08 |
★ php ★ Java와 PHP를 위한 SSO 모듈인 JOSSO (0) | 2011.05.08 |
★ php ★ php에서 변수값을 함수이름으로 사용하여 함수 실행하는 방법 (0) | 2011.05.08 |
UTF-8기준 , php에서 한글 자르는 방법 (0) | 2010.08.28 |