o

코멘트에 파일 첨부하는 방법

안녕하세요 그누보드 잘 쓰고있습니다. 감사합니다.

아래 글은 김영삼님이 답변하신것입니다. 이미지 파일을 올리고 보여주는것까지는 성공했습니다.
--------------------------------------------------------------------------------------------------------
basic 스킨기준입니다.

view_comment.skin.php 의 comment form 에 enctype="multipart/form-data" 추가,
적당한 위치에 <input type=file name=comment_file> 추가,
write_comment_update.skin.php 에

<?
if(is_uploaded_file($comment_file)) {

$tmp_file = $_FILES[comment_file][tmp_name];
$filename = $_FILES[comment_file][name];
$filesize = $_FILES[comment_file][size];

$dest = "$g4[path]/data/file/$bo_table/".$HTTP_POST_FILES[comment_file][name];
move_uploaded_file($HTTP_POST_FILES[comment_file][tmp_name], "$dest");
$imagesize = @getimagesize($dest);
$sql = " insert into $g4[board_file_table]
set bo_table = '$bo_table',
wr_id = '$comment_id',
bf_no = '0',
bf_source = '$filename',
bf_file = '$filename',
bf_content = '{$bf_content}',
bf_download = 0,
bf_filesize = '$filesize',
bf_width = '{$imagesize[0]}',
bf_height = '{$imagesize[1]}',
bf_type = '{$imagesize[2]}',
bf_datetime = '$g4[time_ymdhis]' ";
sql_query($sql);

}
?>
추가,

view_comment.skin.php 코맨트리스트 코맨트내용 밑에
<? $aaa = get_file($bo_table, $comment_id); echo $aaa[0][view];?>
추가.
--------------------------------------------------------------------------------------------------------------

하지만 zip 파일같은 이미지 외의 파일들은 표시조차 되지 않아 질문합니다.
코멘트에 파일을 첨부하고 이미지가 아닌 파일은 다운로드 받을수 있게 할려면 어떻게 해야하나요?

그리고 현재는 파일이 하나만 첨부가 가능한데요. 2개이상을 할려면 어떻게 해야하나요?
파일 여러게올리는건 뭐 코멘트 줄줄이 달아서 하면 될것같은데요. 다운로드만이라도 됐으면 좋겠습니다.

그럼 즐거운 하루되세요.
|

댓글 3개

함수를 참고하세요
$file[$no][href] = "./download.php?bo_table=$bo_table&wr_id=$wr_id&no=$no" . $qstr;
$file[$no][download] = $row[bf_download];
$file[$no][path] = "$g4[path]/data/file/$bo_table";
$file[$no][size] = get_filesize($row[bf_filesize]);
$file[$no][datetime] = $row[bf_datetime];
$file[$no][source] = $row[bf_source];
$file[$no][bf_content] = $row[bf_content];
$file[$no][content] = get_text($row[bf_content]);
$file[$no][view] = view_file_link($row[bf_file], $row[bf_width], $row[bf_height], $file[$no][content]);
$file[$no][file] = $row[bf_file];
$file[$no][image_width] = $row[bf_width] ? $row[bf_width] : 640;
$file[$no][image_height] = $row[bf_height] ? $row[bf_height] : 480;
$file[$no][image_type] = $row[bf_type];

그러니깐
$aaa[0][href]; 이렇게 하면 다운URL 입니다.
$aaa[0][view];이건 위에 보다 시피 이미지 파일만 나타내는 함수구요

나머진 스킨의 view.skin.php 의 > 가변 파일 < 요부분을 참고하세요
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
18년 전 조회 1,670
18년 전 조회 1,661
18년 전 조회 1,566
18년 전 조회 4,928
18년 전 조회 1,957
18년 전 조회 1,405
18년 전 조회 1,709
18년 전 조회 2,039
18년 전 조회 1,523
18년 전 조회 1,565
18년 전 조회 1,571
18년 전 조회 1,674
18년 전 조회 1,558
18년 전 조회 1,519
18년 전 조회 1,746
18년 전 조회 1,606
18년 전 조회 1,882
18년 전 조회 1,759
18년 전 조회 1,575
18년 전 조회 1,629
🐛 버그신고