как правильно принять изображение от пользователя и зашифровать его в Base64 на сервере node.js express

const express = require('express')
const app = express()
const bp = require('body-parser')

app.set('view engine', 'ejs')

app.use ( bp.urlencoded({extended: false}) )

app.get('/', (req,res)=>{
    res.render('ind')
})
app.post('/', (req,res)=>{
    console.log(req.body.title)
    console.log(req.body.description)
    console.log(req.body.mainText)
    console.log(req.body.picture)
})

app.listen(3000, ()=>{
    console.log(3000)
})
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=<device-width>, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form  action="/" method="post">
        <h4>title: </h4>
        <input type="text" name="title" id="title">
        <br>
        <h4>description(описание): </h4>
        <textarea name="description" id="description" cols="30" rows="10"></textarea>
        <br>
        <h4>mainText(основа): </h4>
        <textarea name="mainText" id="mainText" cols="30" rows="10"></textarea>
        <br>
        <h4>picture(изображение): </h4>
            <input type="file" name="picture" id="picture">
        <br>
        <input type="submit" value="Отпарвить">
    </form>
</body>
</html>


Ответы (0 шт):