리스트(목록)에서 첨부파일 다운로드 > 공책

본문 바로가기
010.6356.7610
  • design1001@naver.com
  • @design1001
작업물 전체보기

PHP with GNU

PHP with GNU 리스트(목록)에서 첨부파일 다운로드

페이지 정보

  • 작성자후야
  • 조회 : 244
  • 작성일 : 2022-02-16 13:39

본문

리스트(목록)에서 첨부파일 다운로드 


관리자에서 "목록에서파일사용" 체크 후 사용

  • code
  • source
  1. $sql = "select * from {$g5['board_file_table']} where bo_table = '".$bo_table."' and wr_id = '".$list[$i]['wr_id']."' order by bf_no ";
  2. $result = sql_query($sql);
  3. $nonce = download_file_nonce_key($bo_table, $list[$i]['wr_id']);
  4. while ($row = sql_fetch_array($result)) {
  5. $down_link = "download.php?bo_table={$bo_table}&wr_id={$list[$i][wr_id]}&no={$row[bf_no]}";
  6. $file_source = addslashes($row['bf_source']);
  7. $file_type = preg_replace('/^.*\.([^.]+)$/D', '$1', $file_source);
  8. $file_size = get_filesize($row['bf_filesize']);
  9. if(!in_array($file_type, array('jpg', 'jpeg', 'gif', 'bmp', 'png'))){ //이미지는 제외
  10. echo '<a href="'.$down_link.'" title="'.$file_source.'" class="download"><i class="xi-file-download-o xi-x"></i>'.$file_source.'</a>';
  11. }
  12. }
$sql = "select * from {$g5['board_file_table']} where bo_table = '".$bo_table."' and wr_id = '".$list[$i]['wr_id']."' order by bf_no ";
$result = sql_query($sql);

$nonce = download_file_nonce_key($bo_table, $list[$i]['wr_id']);

while ($row = sql_fetch_array($result)) {
	$down_link = "download.php?bo_table={$bo_table}&wr_id={$list[$i][wr_id]}&no={$row[bf_no]}";
	$file_source = addslashes($row['bf_source']);
	$file_type = preg_replace('/^.*\.([^.]+)$/D', '$1', $file_source);
	$file_size = get_filesize($row['bf_filesize']);

	if(!in_array($file_type, array('jpg', 'jpeg', 'gif', 'bmp', 'png'))){	//이미지는 제외
		echo '<a href="'.$down_link.'" title="'.$file_source.'" class="download"><i class="xi-file-download-o xi-x"></i>'.$file_source.'</a>';
	}
}