Merge remote-tracking branch 'origin/main' into board-select
This commit is contained in:
commit
9902be659e
@ -113,12 +113,16 @@ const write = async () => {
|
||||
if (attachFiles.value && attachFiles.value.length > 0) {
|
||||
for (const file of attachFiles.value) {
|
||||
const formData = new FormData();
|
||||
|
||||
// 파일 이름에서 확장자 제거
|
||||
const fileNameWithoutExt = file.name.replace(/\.[^/.]+$/, ''); // 정규식을 사용하여 확장자 제거
|
||||
|
||||
formData.append('CMNBRDSEQ', boardId);
|
||||
formData.append('CMNFLEORG', file.name);
|
||||
formData.append('CMNFLEEXT', file.name.split('.').pop());
|
||||
formData.append('CMNFLESIZ', file.size);
|
||||
formData.append('CMNFLEPAT', 'boardfile');
|
||||
formData.append('file', file);
|
||||
formData.append('CMNFLEORG', fileNameWithoutExt); // 확장자를 제거한 이름
|
||||
formData.append('CMNFLEEXT', file.name.split('.').pop()); // 확장자
|
||||
formData.append('CMNFLESIZ', file.size); // 파일 크기
|
||||
formData.append('CMNFLEPAT', 'boardfile'); // 파일 경로
|
||||
formData.append('file', file); // 실제 파일 데이터
|
||||
|
||||
await axios.post(`board/${boardId}/attachments`, formData, {
|
||||
headers: {
|
||||
@ -127,7 +131,6 @@ const write = async () => {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
alert('게시물이 작성되었습니다.');
|
||||
goList();
|
||||
} catch (error) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user