파일명 수정

This commit is contained in:
dyhj625 2025-01-21 13:16:27 +09:00
parent 795f740ee9
commit 888eaba2e9

View File

@ -113,12 +113,16 @@ const write = async () => {
if (attachFiles.value && attachFiles.value.length > 0) { if (attachFiles.value && attachFiles.value.length > 0) {
for (const file of attachFiles.value) { for (const file of attachFiles.value) {
const formData = new FormData(); const formData = new FormData();
//
const fileNameWithoutExt = file.name.replace(/\.[^/.]+$/, ''); //
formData.append('CMNBRDSEQ', boardId); formData.append('CMNBRDSEQ', boardId);
formData.append('CMNFLEORG', file.name); formData.append('CMNFLEORG', fileNameWithoutExt); //
formData.append('CMNFLEEXT', file.name.split('.').pop()); formData.append('CMNFLEEXT', file.name.split('.').pop()); //
formData.append('CMNFLESIZ', file.size); formData.append('CMNFLESIZ', file.size); //
formData.append('CMNFLEPAT', 'boardfile'); formData.append('CMNFLEPAT', 'boardfile'); //
formData.append('file', file); formData.append('file', file); //
await axios.post(`board/${boardId}/attachments`, formData, { await axios.post(`board/${boardId}/attachments`, formData, {
headers: { headers: {
@ -127,7 +131,6 @@ const write = async () => {
}); });
} }
} }
alert('게시물이 작성되었습니다.'); alert('게시물이 작성되었습니다.');
goList(); goList();
} catch (error) { } catch (error) {