Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 712 Bytes

Error.md

File metadata and controls

28 lines (21 loc) · 712 Bytes

Some error

  • socket can't send any data after mongo updated
  • client can't save token

Solved Problem

Send image file:

  • Input
<input
    accept="image/*"
    multiple
    type="file"
    alt="image"
    style={{ display: 'none' }}
    id={id}
    onChange={onChange}
/>
  • Client Handle: e.target.files or e.target.file

  • Send by axios. Create new FormData() and append all of images with the same field name .

  • Server Handle: receive by multer. The field name of upload.array("field name") must be alike of client's

  • Read file from path -> store by cloudinary -> get url and remove file from this path -> send url back to client to display