Skip to content

Commit

Permalink
[FEAT] 10MB 이상 이미지 업로드 제한
Browse files Browse the repository at this point in the history
  • Loading branch information
boeunLee committed May 21, 2024
1 parent 19fc0a0 commit da05d2f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/ImageUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ const ImageUploader = (props: containerSize) => {
if (files == null || files.length === 0) return;

const file = files[0];
console.log(file.size);

if (file.size > 10 * 1024 * 1024) {
window.alert('이미지 크기는 10MB 이하여야 합니다.');
return;
}

// 파일 확장자가 jpg면 return
const fileExtension = getFileExtension(file.name);
Expand Down

0 comments on commit da05d2f

Please sign in to comment.