hiteshchoudhary / chai-backend

A video series on chai aur code youtube channel
5.36k stars 803 forks source link

Update user.controller.js #106

Closed Divyesh032040 closed 7 months ago

Divyesh032040 commented 7 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