게시판 글 엑셀다운 첨부파일 경로 URL 채택완료
국자
2년 전
조회 2,167
아래 게시판 글 엑셀파일 다운 소스입니다.
여기에서 게시글에 등록된 첨부파일 경로(url)도 추가하고 싶은데
방법을 알고 계신분은 답변 부탁드립니다.
해당 url 클릭하면 다운 받을 수 있게 하고자 합니다.
ex) 다운받은 엑셀에서 pdf 파일경로 또는 zip 파일경로 클릭시 "다운로드 되기"
알기쉽게 코드예제 부탁드립니다.
고수님들 답변 꼭 부탁드립니다. ㅜㅜ
감사합니다.
-------------------------------------------------------
</p>
<p><?php
include_once('_common.php');
echo '<meta charset="utf-8">';</p>
<p>$sql = " select
bo_subject
from g5_board A
where 1 = 1
and bo_table = '{$bo_table}'
";
$title = sql_fetch($sql);</p>
<p>$sql = " select
A.*
from g5_write_{$bo_table} A
where 1 = 1
order by wr_datetime desc
";
$result = sql_query($sql);</p>
<p>header("Content-Type: application/vnd.ms-excel");
header("Content-Type: application/x-msexcel");
header("Content-Disposition: attachment; filename={$bo_table}.xls");
header("Content-Description: PHP4 Generated Data" );
header("Content-charset=utf-8");
?></p>
<p><html>
<head>
<style>
.sty { font-family:굴림; font-size:12px;}
.sty0 { font-family:굴림; font-size:12px; text-align:center;}
.sty1 {mso-number-format:"\@";font-family:굴림; font-size:12px}
.sty2 {font-family:굴림; font-size:12px}
.sty3 {font-family:굴림; font-size:12px; color: #ff0000}
.title {font-family:굴림; font-size:12px; font-weight:600}
.title_s {font-family:굴림; font-size:16px}
</style>
</head>
<body bgcolor="#FFFFFF">
<table border="1" style="table-layout:fixed">
<tr>
<td colspan="17" class="title"><?php echo $title['bo_subject'];?></td>
</tr>
<tr align="center">
<td bgcolor="#CCFFCC">순번</td>
<td bgcolor="#CCFFCC">등록일자</td>
<td bgcolor="#CCFFCC">등록자</td>
<td bgcolor="#CCFFCC">제목</td>
<td bgcolor="#CCFFCC">내용</td>
<td bgcolor="#CCFFCC">이메일</td>
<td bgcolor="#CCFFCC">등록아이피</td>
<td bgcolor="#CCFFCC">추가필드1</td>
<td bgcolor="#CCFFCC">추가필드2</td>
<td bgcolor="#CCFFCC">추가필드3</td>
<td bgcolor="#CCFFCC">추가필드4</td>
<td bgcolor="#CCFFCC">추가필드5</td>
<td bgcolor="#CCFFCC">추가필드6</td>
<td bgcolor="#CCFFCC">추가필드7</td>
<td bgcolor="#CCFFCC">추가필드8</td>
<td bgcolor="#CCFFCC">추가필드9</td>
<td bgcolor="#CCFFCC">추가필드10</td>
</tr></p>
<p><?php
for ($i=0; $row=sql_fetch_array($result); $i++) {
?>
<tr>
<td class="sty1"><?php echo ($i + 1);?></td>
<td class="sty1"><?php echo substr($row['wr_datetime'], 0, 11);?></td>
<td class="sty1"><?php echo $row['wr_name'] . ' (' . $row['mb_id'] . ')' ;?></td>
<td class="sty1"><?php echo $row['wr_subject'];?></td>
<td class="sty1"><?php echo strip_tags($row['wr_content']);?></td>
<td class="sty1"><?php echo $row['wr_email'];?></td>
<td class="sty1"><?php echo $row['wr_ip'];?></td>
<td class="sty1"><?php echo $row['wr_1'];?></td>
<td class="sty1"><?php echo $row['wr_2'];?></td>
<td class="sty1"><?php echo $row['wr_3'];?></td>
<td class="sty1"><?php echo $row['wr_4'];?></td>
<td class="sty1"><?php echo $row['wr_5'];?></td>
<td class="sty1"><?php echo $row['wr_6'];?></td>
<td class="sty1"><?php echo $row['wr_7'];?></td>
<td class="sty1"><?php echo $row['wr_8'];?></td>
<td class="sty1"><?php echo $row['wr_9'];?></td>
<td class="sty1"><?php echo $row['wr_10'];?></td>
</tr>
<?php }</p>
<p>?>
</table>
</body>
</html></p>
<p>
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
2년 전
for ($i=0; $row=sql_fetch_array($result); $i++) {
밑에 </p>
<p> $file = get_file($bo_table, $row['wr_id']);
for($k=0; $k< $file['count']; $k++){
$fileurl = $file[$k]['path']."/".$file[$k]['file'];
echo '<a href="'.$fileurl.'">다운로드</a>';
}</p>
<p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 3개
�
국자
2년 전
�
엑스엠엘
2년 전
view.skin.php에 보시면
첨부 파일 받는 링크 출력하는 부분이 있습니다.
그 부분 참고하세요.
첨부 파일 받는 링크 출력하는 부분이 있습니다.
그 부분 참고하세요.
�
국자
2년 전
감사합니다!~ 참고해서 해볼께요~^^
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
정말정말 감사드립니다.ㅜㅜ
진짜 고수시네요~
그런데 한가지만 질문 더 드려도 될까요?
파일을 다운 받았더니 파일명이 변환된 형태인데..
다운받을때 변환된 파일명 말고,
마치 게시판에서 다운받는것처럼..
원래 파일명으로 다운될 수는 없을까요?