첨부파일 추가기능 문의합니다
본문
https://sir.kr/g5_skin/1309
제가 첨부파일을 [ + ] 키 누르면
첨부파일이 나타나는 그런 팁을 적용했는데요...
+키를 누르면
2개가 됩니다
베이직 스킨에서
코드를 수정/추가한것은 딱 2가지입니다
파일첨부쪽에는
<?php for ($i=0; $is_file && $i<=$file['count'];$i++) { ?>
<tr>
<th scope="row">파일</th>
<td>
<input type="file" name="bf_file[]" title="파일첨부 <?php echo $i+1 ?> : 용량 <?php echo $upload_max_filesize ?> 이하만 업로드 가능" class="frm_file frm_input" style="display:inline-block;">
<?php if ($i==0) { ?>
<button type="button" class="btn_frmline fwzadd">추가 </button>
<?php } ?>
<?php if ($is_file_content) { ?>
<input type="text" name="bf_content[]" value="<?php echo $file[$i]['bf_content']; ?>" title="파일 설명을 입력해주세요." class="frm_file frm_input" size="50">
<?php } ?>
<?php if($w == 'u' && $file[$i]['file']) { ?>
<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>
<?php } ?>
</td>
</tr>
<?php } ?>
이것을 추가햇고요
하단쪽에 스크립트에는
<?php if ($is_file) {?>
function addFileInput() {
var flen = $("input[name='bf_file[]']").length;
var upload_count = <?php echo (int)$file_count?>;
if (upload_count && flen >= upload_count)
{
alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
return;
}
var appendHtml = "";
appendHtml += "<tr>";
appendHtml += "<th scope='row'>파일</th>";
appendHtml += "<td>";
appendHtml += " <input type='file' name='bf_file[]' title='파일첨부 : 용량 <?php echo $upload_max_filesize ?> 바이트 이하만 업로드 가능' class='frm_file frm_input' style='display:inline-block;'>";
appendHtml += " <button type='button' class='btn_frmline fwzdel'>삭제</button>";
<?php if ($is_file_content) { ?>
appendHtml += " <input type='text' name='bf_content[]' value='' title='파일 설명을 입력해주세요.' class='frm_file frm_input' size='50'>";
<?php } ?>
appendHtml += "</td>";
appendHtml += "</tr>";
$(".tbl_frm01 table:first-child").append(appendHtml);
}
$(document).ready(function(){
// 첨부파일 추가.
$('.tbl_frm01 table .fwzadd').live('click',(function() {
addFileInput();
}));
// 첨부파일 삭제.
$('.tbl_frm01 table .fwzdel').live('click',(function() {
$(this).parents("tr:first").remove();
}));
});
<?php } ?>
이 코드를 넣었습니다
그래서 적용이 됐는데요
저는 파일업로드 부분을
하단이 아닌...제목 바로 아래에 적용하고 싶어서
파일 코드를 제목 바로 아래다가 넣었습니다
근데 추가를 누르면
[제목아래 하나/맨 하단에 하나]
추가되는 파일하나가 맨 하단에 생깁니다
원래는 링크 아래쪽에 있는거라서
추가 누르면 잘 적용이 됐는데
저는 제목 아래쪽에 원해서 코드를 제목아래로 해도
추가를 누르면
추가된 하나의 파일코드가
맨 하단에 추가가 됩니다
기본 코드가 아닌
스크립트를 수정해야되는것인지..
소스를 봐도 잘 모르겠고
맨 하단으로 안가고
제목 아래에서 추가가 될수는 없는걸까여?
도움좀 부탁드려봅니다
답변을 작성하시기 전에 로그인 해주세요.