Answer the question
In order to leave comments, you need to log in
How to send accepted file using formData?
Hello. Found the express-formidable library. It takes a file, saves it to the Temp folder.
Firstly, I would like to know how to save the received file in the server directory (there is no information about this even in the official documentation)
Secondly, please tell me how you can send this file to another server (another server accepts FormData)
Here my server:
const express = require('express');
const formidable = require('express-formidable');
const PORT = 8000;
const app = express();
app.use(express.urlencoded({extended: false}));
app.use(formidable());
app.listen(PORT, () =>{
console.log(`Server works on port ${PORT}`);
});
app.get('/', (req, res) =>{
res.send('server works, PORT is ' + PORT);
});
app.post('/upload', (req, res) => {
res.send(req.files);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question