첨부파일 업로드 제약 조건 추가 및 APIM 서비스 파일 컨텍스트 처리
- 첨부파일 업로드 시 파일 크기/형식 조건 동적 적용 - FileTypeContext.clear 호출 추가, 내부 사용자 컨텍스트 정리
This commit is contained in:
+1
@@ -44,6 +44,7 @@ public class PartnershipApplicationFacadeImpl implements PartnershipApplicationF
|
||||
FileTypeContext.setFileType("business");
|
||||
file = fileService.createFile(partnershipApplicationDTO.getFiles());
|
||||
} finally {
|
||||
FileTypeContext.clear();
|
||||
FileService.clearInternalUserContext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,9 +113,12 @@
|
||||
<label for="file" class="file-upload-btn">
|
||||
파일 선택
|
||||
</label>
|
||||
<input type="file" id="file" name="file" style="display: none;" />
|
||||
<input type="file" id="file" name="files"
|
||||
th:accept="${isInternalUser ? '*' : '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.hwp,.gif,.jpg,.jpeg,.png'}"
|
||||
style="display: none;" />
|
||||
</div>
|
||||
<small class="form-help-text" style="margin-top: 8px; display: block; color: #8c959f;">
|
||||
<span th:text="'첨부파일은 ' + ${@portalProperties.file.maxSize} + ' 이내로 등록해 주세요. '">첨부파일은 8MB 이내로 등록해 주세요. </span>
|
||||
문서파일(pdf, doc, docx, xls, xlsx, ppt, pptx, hwp)과 이미지 파일(gif, jpg, png)만 등록 가능합니다.
|
||||
</small>
|
||||
</div>
|
||||
@@ -217,6 +220,14 @@
|
||||
}
|
||||
/*[/]*/
|
||||
|
||||
const maxSizeBytes = (window.PORTAL_CONFIG && window.PORTAL_CONFIG.file)
|
||||
? window.PORTAL_CONFIG.file.maxSizeBytes : 0;
|
||||
if (maxSizeBytes > 0 && file.size > maxSizeBytes) {
|
||||
customPopups.showAlert('첨부파일은 ' + window.PORTAL_CONFIG.file.maxSize + ' 이내로 등록해 주세요.');
|
||||
fileInput.value = '';
|
||||
return;
|
||||
}
|
||||
|
||||
if (fileDisplayText && fileInputDisplay && btnRemoveFile) {
|
||||
fileDisplayText.textContent = file.name;
|
||||
fileDisplayText.classList.add('has-file');
|
||||
|
||||
Reference in New Issue
Block a user