- socket can't send any data after mongo updated
- client can't save token
Send image file:
- Input
<input
accept="image/*"
multiple
type="file"
alt="image"
style={{ display: 'none' }}
id={id}
onChange={onChange}
/>
-
Client Handle:
e.target.files
ore.target.file
-
Send by
axios
. Createnew FormData()
and append all of images with the samefield name
. -
Server Handle: receive by
multer
. Thefield name
ofupload.array("field name")
must be alike of client's -
Read file from
path
-> store bycloudinary
-> geturl
and remove file fromthis path
-> sendurl
back to client to display