Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

file upload in node js

const multer = require('multer');


const storage = multer.diskStorage({
    destination: function (req, file, cb) {
        cb(null, './uploads/')
    },
    filename: function(req, file, cb){
        cb(null, file.fieldname + '-'+ file.originalname+ '-' +  Date.now())
    }
});

const upload = multer({storage:storage})
 
PREVIOUS NEXT
Tagged: #file #upload #node #js
ADD COMMENT
Topic
Name
3+6 =