Skip to content

Instantly share code, notes, and snippets.

Last active Dec 19, 2019
What would you like to do?
const express = require("express");
const bp = require("body-parser");
const port = 5000;
const app = express();
const multer = require("multer");
app.use(bp.urlencoded({ extended: false }));
var storage = multer.diskStorage({
destination: function(req, file, cb) {
cb(null, "./"); // here we specify the destination . in this case i specified the current directory
filename: function(req, file, cb) {
cb(null, file.originalname);// here we specify the file saving name . in this case i specified the original file name
var uploadDisk = multer({ storage: storage });"/fileuploaddisk", uploadDisk.single("image"), (req, res) => {
console.log(" file disk uploaded");
res.send("file disk upload success");
app.listen(port, () => {
console.log("Express server listning on port " + port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment