D
D
Denis11112019-02-07 19:15:41
Node.js
Denis1111, 2019-02-07 19:15:41

How to process files and other data(input) in NodeJS server?

How to process files and other data in nodeJS server?
File upload was using Dropzone

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Somewhere Intech, 2019-02-09
@john36allTa

If you use Express as a web server, then:

expressServer.post('/', function (req, res) {
  fs.readFile(req.files.inputFieldName.path, function (err, data) {
  // inputFieldName - имя input в форме
  var newPath = __dirname + "/uploads/uploadedFileName";
  fs.writeFile(newPath, data, function (err) {
    res.redirect("back");
  });
});
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question