Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

multer file type validation

fileFilter: (req,file,callback) => {
        const types = /png|jpg|jpeg|webp|gif|webp|svg/
        const extName = types.test(path.extname(file.originalname).toLocaleLowerCase())
        const mimetype = types.test(file.mimetype)
        if(extName && mimetype){
            callback(null,true)
        } else{
            cb(new Error("Only supported png,jpeg,jpg,gif,webp and svg format image"))
        }
    }
Comment

PREVIOUS NEXT
Code Example
Javascript :: js get element padding 
Javascript :: how to clear nodemon cache 
Javascript :: jquery add remove class clicked element 
Javascript :: installation of material ui core using npm 
Javascript :: how to disable a div in javascript 
Javascript :: jquery ajax 
Javascript :: js change root css variable 
Javascript :: jquery get base url 
Javascript :: javascript localStorage clear items 
Javascript :: enable version 12 node glitch 
Javascript :: jquery current timestamp 
Javascript :: js remove duplicates from array 
Javascript :: express js get origin 
Javascript :: how to add multiple css style in javascript 
Javascript :: get pods on specific node 
Javascript :: javascript sort array by Z-A in js 
Javascript :: how to set form control value in angular 
Javascript :: sh: generated/aesprim-browser.js: Permission denied 
Javascript :: byte to gb javascript 
Javascript :: foreach nodejs 
Javascript :: get number of days in a month javascript 
Javascript :: chartjs remove legend 
Javascript :: replacing characters in string javascript 
Javascript :: useeffect will unmount 
Javascript :: js get number from string 
Javascript :: reactjs variable in string 
Javascript :: mysql innodb_buffer_pool_size 
Javascript :: how to change input required message react 
Javascript :: enzyme change input value 
Javascript :: brand icons in next js 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =