오늘 오랜만에 자바스크립트 fetch API로 파일 업로드를 할 일이 있었는데 참으로 멍청한 실수를 했음.
input[type=file] 의 files 값을 받아왔어야 했는데 value를 받아서 넘기는 바람에 컨트롤러가 파일이 없다고 에러를 뿜어댄 것.

요약)
document.querySelector('input.yourInputClass[type=file]').value (X)
document.querySelector('input.yourInputClass[type=file]').files[0] (O)

오늘의 나는 멍청이 ㅠㅠ


WRITTEN BY
artfrige
베이스 연주는 건강에 좋습니다
,