latest.skin.php 에서 해당 게시물 첨부파일 주소를 어떻게 가져 오나요?

latest.skin.php 에서 해당 게시물 첨부파일 주소를 어떻게 가져 오나요?

QA

latest.skin.php 에서 해당 게시물 첨부파일 주소를 어떻게 가져 오나요?

답변 4

본문

최신글에서 첨부파일 pdf를 새창으로 바로 열려고 하는데..

첨부파일 주소?를 가져오는 코드를 못짜서 밤을 꼬박새었네요....삽질한 코드 보여드리기 민망한데...


$sql = " select * from {$g5['board_file_table']} bo_table='$bo_table' and wr_id='$wr_id' order by bf_no ";

 
while ($row = sql_fetch_array($result))
{
$no = $row['bf_no'];
$filemy[$no]['path'] = G5_DATA_URL.'/file/'.$bo_table;
$filemy[$no]['source'] = addslashes($row['bf_source']);
// $filemy$no]['bf_content'] = $row['bf_content'];
$filemy[$no]['file'] = $row['bf_file'];
$filemy['count']++;
}
return $filemy;

이렇게 해서 $filemy 를 가져와서 ...


<iframe src="<?=$filemy?>" style="width:700px; height:700px;" frameborder="0"></iframe>

이렇게 붙여볼라 했는데....

 

이 질문에 댓글 쓰기 :

답변 4

그누보드 get_file 함수를 이용해보세요.

아이프레임으로 pdf가 보이지는 지는 모르겠는데

해당 처럼 가지고 와서는 바로 $filemy로 하시는게 아니라 

해당을 배열로 돌리셔서 업로드된 파일명이 file 일테니 해당 배열값을 이용해서 풀주소를 만들어주시면 됩니다.

위에 하걸로 치면 path와 file을 연결해서 쓰시면 될거같습니다.

저렇게 넣으면 소스코드상 src="Array" 이렇게 나오지 않나요?;;

요거 한번 보시고 발상을 바꿔보시는 것도 하나의 방법이 아닐까 싶어요

https://be-a-weapon.tistory.com/m/261



$sql = " select * from {$g5['board_file_table']} bo_table='$bo_table' and wr_id='$wr_id' order by bf_no ";

$filemy = array();
while ($row = sql_fetch_array($result))
{
  $filemy[] = $row ;
}
return $filemy;

 


<?php for($i=0; count($filemy) > $i; $i++){ ?>

<iframe src="<?=G5_DATA_URL.'/file/'.$bo_table."/".$filemy[$i]['bf_source']?>" style="width:700px; height:700px;" frameborder="0"></iframe>

<?php } ?>

답변을 작성하시기 전에 로그인 해주세요.
전체 3
© SIRSOFT
현재 페이지 제일 처음으로