라공에디션

게시판 파일 첨부 이미지만 가능한 제한 풀기

<span class="sv_member">니루</span>
니루 @tabom0w0
2026-07-01 19:43

기존에는 이미지만 올라가서 bbs/write_file.common.php 에서 이미지만 허용하던거 풀어줬음


bbs/write_file.common.php 에서 이 부분을 찾아서

// 파일 처리
    function handleFiles(files) {
        const currentTotal = getTotalFileCount();
        if (currentTotal + files.length > maxFiles) {
            alert('최대 ' + maxFiles + '개의 파일만 업로드할 수 있습니다.');
            return;
        }

        for (let i = 0; i < files.length; i++) {
            const file = files[i];

            // 이미지 파일 확인
            if (!file.type.startsWith('image/')) {
                alert(file.name + '은(는) 이미지 파일이 아닙니다.');
                continue;
            }

            if (getTotalFileCount() >= maxFiles) break;

            fileArray.push(file);
            // 현재 전체 파일 개수가 새 파일의 인덱스
            const newIndex = getTotalFileCount();
            addFilePreview(file, newIndex);
        }

        updateMessage();
    }


이렇게 바꿔줌

 // 파일 처리
        function handleFiles(files) {
            const currentTotal = getTotalFileCount();
            if (currentTotal + files.length > maxFiles) {
                alert('최대 ' + maxFiles + '개의 파일만 업로드할 수 있습니다.');
                return;
            }

            for (let i = 0; i < files.length; i++) {
                const file = files[i];

                // 이미지 파일 확인
                // if (!file.type.startsWith('image/')) {
                //     alert(file.name + '은(는) 이미지 파일이 아닙니다.');
                //     continue;
                // }

                // 파일 크기 검증만 유지
                if (file.size === 0) {
                    alert(file.name + '은(는) 빈 파일입니다.');
                    continue;
                }

                if (getTotalFileCount() >= maxFiles) break;

                fileArray.push(file);
                // 현재 전체 파일 개수가 새 파일의 인덱스
                const newIndex = getTotalFileCount();
                addFilePreview(file, newIndex);
            }

            updateMessage();
        }



clipboard_1782902551071.png

작성중에 이미지도 아닌게 플레이스홀더 이미지처럼 생기면서 엑박떠서 보기 좀 그렇긴 한데?

쓸만하면 된거죠?


{이미지:0}

근데 이거 홀더 넣음 어케 되냐?

걍 텍스트가 됩니다

첨부된 파일은 아래에 뜨긴 떠요

첨부파일

댓글목록

등록된 댓글이 없습니다.

카드 만들기
정렬
글자 크기
52px
배경
글자색
배경색