Answer the question
In order to leave comments, you need to log in
Uploading files in Node.js?
It is necessary to implement the following process:
From the Android application using Java, send a file/image to the Node.js server. The server processes the file and stores it in its directory.
By what means is it possible to implement a server with similar functionality and is it possible at all? That is: it is necessary that the server somehow gets the file from the client's request.
I know that in Node.js file uploads can be implemented using forms, but this does not suit me. I will be grateful for help.
Answer the question
In order to leave comments, you need to log in
FileManager.uploadFileToS3(req.file('file'), function(err, uploadedFiles) {
if (err) {
//...
}
use node-formidable
server.post("/uploads", (req, res) => {
new formidable.IncomingForm()
.parse(req)
.on("file", function(name, file) {
console.log("Got file:", name);
})
.on("field", function(name, field) {
console.log("Got a field:", name);
})
.on("error", function(err) {
next(err);
})
.on("end", function() {
res.end();
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question