Uploading Files

Make File Input: In your HTML, make a file input:
<input type="file">
Send Request: In your client JavaScript, send a POST request with a FormData object:
let formData = new FormData()
formData.append(`yourKey`, yourFileInput.files[0])

let request = new XMLHttpRequest()
request.open(`POST`, `/your-route`)
request.send(formData)
Add Package: express-fileupload
Include Module:
let fileUpload = require(`express-fileupload`)
Use Middleware:
app.use(fileUpload())
Add Folder: Add a new folder for uploaded files.
Make Endpoint: Make an endpoint to match your file upload request.
Save File: In your file upload endpoint, get the file from the request, and save it to the new folder:
let file = request.files.yourKey
file.mv(`${__dirname}/your-folder/${file.name}`)
More Info: npm page