Skip to content

Instantly share code, notes, and snippets.

@msukmanowsky
Created March 29, 2019 18:04
Show Gist options
  • Save msukmanowsky/024742f44aacd425f14d7254595684c8 to your computer and use it in GitHub Desktop.
Save msukmanowsky/024742f44aacd425f14d7254595684c8 to your computer and use it in GitHub Desktop.
const express = require('express');
const { filesUpload } = require('./middleware');
app = express();
app.post('/upload', filesUpload, function(req, res) {
// will contain all text fields
req.body
// will contain an array of file objects
/*
{
fieldname: 'image', String - name of the field used in the form
originalname, String - original filename of the uploaded image
encoding, String - encoding of the image (e.g. "7bit")
mimetype, String - MIME type of the file (e.g. "image/jpeg")
buffer, Buffer - buffer containing binary data
size, Number - size of buffer in bytes
}
*/
req.files
})
exports = app;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment