-
카테고리
-
세부 분야
풀스택
-
해결 여부
미해결
req.file.location 질문입니다.
22.04.20 22:39 작성 조회수 288
0
안녕하세요 node.js 수강중인 수강생입니다.
익스프레스로 SNS 서버만들기 강의중에 궁금한점이 있어서요
이미지 업로드후 미리보기를 구현할때
console.log(req.file);
const originalUrl = req.file.location;
const url = originalUrl.replace(/\/original\//, '/thumb/')
res.json({ url, originalUrl: req.file.location });
이렇게 적어주셨는데요
로그를 봐도 location 이란 속성이 없어서 error 가 나오는데
혹시 제가 빠트린게 있을까요?
아래 log 에는 location 소성이 없어서 undefinded 를 반환하고 있습니다.
일단은
res.json({url : `/img/${req.file.filename}` , originalUrl : `/img/${req.file.filename}` });
이렇게 별도로 originalUrl 을 처리하고 있긴한데 location 속성이 안되서 여쭈어봅니다.
답변을 작성해보세요.
0
답변 1