그누보드 첨부파일 따로따로~?
본문
안녕하세요.
<tr>
<th scope="row">차량등록증</th>
<td>
<input type="file" name="bf_file[13]" title="차량등록증" class="frm_file frm_input">
<?php if ($is_file_content) { ?>
<input type="text" name="bf_content[13]" value="<?php echo ($w == 'u') ? $file[13]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="frm_file frm_input">
<?php } ?>
<?php if($w == 'u' && $file[13]['file']) { ?>
<input type="checkbox" id="bf_file_del13" name="bf_file_del[13]" value="1"> <label for="bf_file_del13"><?php echo $file[13]['source'].'('.$file[13]['size'].')'; ?> 파일삭제</label>
<?php } ?>
</td>
<th scope="row">성능점검표</th>
<td>
<input type="file" name="bf_file[14]" title="성능점검표" class="frm_file frm_input">
<?php if ($is_file_content) { ?>
<input type="text" name="bf_content[14]" value="<?php echo ($w == 'u') ? $file[14]['bf_content'] : ''; ?>" title="파일 설명을 입력해주세요." class="frm_file frm_input">
<?php } ?>
<?php if($w == 'u' && $file[14]['file']) { ?>
<input type="checkbox" id="bf_file_del14" name="bf_file_del[14]" value="1"> <label for="bf_file_del14"><?php echo $file[14]['source'].'('.$file[14]['size'].')'; ?> 파일삭제</label>
<?php } ?>
</td>
</tr>
이렇게 bf_file_13, 14번은 따로따로,
1~12번은 그대로 출력하고싶습니다
<?if($is_file){?>
<tr>
<th scope="row">파일</th>
<td colspan="3">
<?php for ($i=0; $is_file && $i<12; $i++) { ?>
<div class="bo_w_flie write_div write_div_<?php echo $i+1 ?>">
<div class="file_wr write_div">
<label for="bf_file_<?php echo $i+1 ?>" class="lb_icon"><i class="fa fa-folder-open"
aria-hidden="true"></i><span class="sound_only"> 파일 #<?php echo $i+1 ?></span></label>
<input type="file" name="bf_file[]" id="bf_file_<?php echo $i+1 ?>"
title="파일첨부 <?php echo $i+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file ">
<div class="img_wrap">
<img id="img_<?php echo $i+1 ?>" />
</div>
</div>
<!-- 파일첨부시 썸네일보기 -->
<script type="text/javascript">
var sel_file<?php echo $i+1 ?>;
$(document).ready(function() {
$("#bf_file_<?php echo $i+1 ?>").on("change", handleImgFileSelect<?php echo $i+1 ?>);
});
function handleImgFileSelect<?php echo $i+1 ?>(e) {
var files<?php echo $i+1 ?> = e.target.files;
var filesArr<?php echo $i+1 ?> = Array.prototype.slice.call(files<?php echo $i+1 ?>);
filesArr<?php echo $i+1 ?>.forEach(function(f) {
if(!f.type.match("image.*")) {
alert("이미지 파일만 첨부해주세요.");
return;
}
sel_file<?php echo $i+1 ?> = f;
var reader<?php echo $i+1 ?> = new FileReader();
reader<?php echo $i+1 ?>.onload = function(e) {
$("#img_<?php echo $i+1 ?>").attr("src", e.target.result);
}
reader<?php echo $i+1 ?>.readAsDataURL(f);
});
}
</script>
<?php if ($is_file_content) { ?>
<input type="text" name="bf_content[]" value="<?php echo ($w == 'u') ? $file[$i]['bf_content'] : ''; ?>"
title="파일 설명을 입력해주세요." class="full_input frm_input" placeholder="파일 설명을 입력해주세요.">
<?php } ?>
<?php if($w == 'u' && @$file[$i]['file']) { ?>
<span class="file_del">
<?php
$file = get_file($bo_table, $wr_id);
$image = urlencode($file[$i]['file']);
$image_path = G5_DATA_PATH.'/file/'.$bo_table;
$image_url = G5_DATA_URL.'/file/'.$bo_table;
if (preg_match("/\.(gif|jpg|jpeg|png)$/i", $image)) {
$thumb = thumbnail($image, $image_path , $image_path , 80, 80, false, true);
$image_content = $image_url.'/'.$thumb;
echo "<img src=".$image_content.">";
}
?>
<input type="checkbox" id="bf_file_del<?php echo $i ?>" name="bf_file_del[<?php echo $i; ?>]"
value="1"> <label
for="bf_file_del<?php echo $i ?>"><?php echo $file[$i]['source'].'('.$file[$i]['size'].')'; ?> 파일
삭제</label>
</span>
<?php } ?>
</div>
<?php } ?>
</td>
</tr>
<?}?>
이렇게 하였는데.. 되지않네요 ㅠ
문제가 무엇인가요..?
답변 1
<?php for ($i=0; $is_file && $i<12; $i++) { ?>
to
<?php for ($i=0; $is_file && $i<14; $i++) { ?>