hiteshchoudhary / chai-backend

A video series on chai aur code youtube channel
4.69k stars 697 forks source link

Update user.controller.js #106

Closed Divyesh032040 closed 5 months ago

Divyesh032040 commented 5 months ago

we have to also check is req.files.avatar? if yes than we can access its [0] otherwise its show this error if user not send avatar file : TypeError: Cannot read properties of undefined (reading '0') --> so right way is const avatarLocalPath = req.files?.avatar?.[0]?.path; to access avatar local path