Skip to content

Commit

Permalink
Merge pull request #193 from Neogasogaeseo/feat/#191
Browse files Browse the repository at this point in the history
FileUploader 버그 해결하기
  • Loading branch information
NamJwong authored Feb 16, 2022
2 parents 0ef28af + beaf558 commit f97f151
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/presentation/components/common/FileUpload/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useEffect, useRef, useState } from 'react';

import { useToast } from '@hooks/useToast';
import { checkBrowser } from '@utils/browser';
import { resizeImage } from '@utils/image';
import React, { useEffect, useRef, useState } from 'react';
import { StImgPreview, StFileUpload, StUploadBtn } from './style';

interface FileUploadProps {
Expand Down Expand Up @@ -32,9 +33,8 @@ function FileUpload(props: FileUploadProps): React.ReactElement {

const fileInputHandler = async (e: React.ChangeEvent<HTMLInputElement>) => {
e.preventDefault();
if (e.target.files !== null) {
if (e.target.files !== null && e.target.files.length > 0) {
const file = e.target.files[0];
if (!file) return fireToast({ content: '이미지 파일을 첨부해주세요' });
if (file.name.match(imgFileForm)) {
if (checkBrowser('Internet Explorer')) {
setNewFile(file);
Expand Down

0 comments on commit f97f151

Please sign in to comment.