when trying to upload image from postman i am getting unexpected end of form error

Ankit Member Posts: 1
edited April 4 in Developer APIs

my index.js part const express = require("express")const app = express()const mongoose = require("mongoose")const cors = require("cors")const route = require("./route")const mult = require('multer')const fileUpload = require("express-fileupload");
app.use(  fileUpload({    useTempFiles: true  }));

my clodinary function file - const cloudinary = require("cloudinary").v2
cloudinary.config({     cloud_name: '******',     api_key: '********',     api_secret: '***************************'});

const fileUpload = async(file)=>{    const image = await cloudinary.uploader.upload(        file,        (result) => result      );      return image;        }module.exports = {fileUpload}

my controller - const uploadpic = async(req, res)=>{  const {file} = req.files;  if (!req.files) return res.send('Please upload an image');  const cloudFile = await uploadImage(file.tempFilePath);  console.log(cloudFile)
  return res.status(201).json({      message:'Image uploaded successfully',      imageUrl:cloudFile.url  })



  • Tamara
    Tamara Member, Cloudinary Staff Posts: 93

    Hi there,

    Looking at our logs, I can see the following error for all of your upload calls: Missing required parameter - file

    Please try again and include the file in your request.

    Best regards,