// pages/api/upload.js import fs from "fs"; import path from "path"; import formidable from "formidable"; export default async function handler(req, res) { if (req.method === "POST") {
const formData = await req.formData(); // Get the file from the form data const file = formData.get("file");
console.log("====================================");
console.log(file);
res.status(200).json({ data: "sad" });
} else { res.status(405).end(`Method ${method} Not Allowed`); } }