Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including multer-cloudinary with all npm packages installed. Try it out:

var multerCloudinary = require("multer-cloudinary")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

multer-cloudinary v1.1.0

A simple multer storage engine which directly uploads image to cloudinary

multer-cloudinary

A simple storage engine which stores the files directly on cloudinary

var multerCloudinary = require('multer-cloudinary');
var Cloudinary = require('cloudinary');
Cloudinary.config({
  {
    cloud_name: '-----',
    api_key: '------',
    api_secret: '-----',
  }
});
var cloudinaryStorage = multerCloudinary({cloudinary: Cloudinary});

var cloudinaryUpload = multer({storage: cloudinaryStorage});
// It will upload a file which is received in form-data from the client. Key for the file is 'photo1'. 
router.put('/me', cloudinaryUpload.fields([{name: 'cover', maxCount:1}]));
// If you want to upload more than one file from form data, then add the 
router.put('/me', cloudinaryUpload.fields([{name: 'photo1', maxCount:1},{name: 'photo2', maxCount:1}]));
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free