svrjs-nextjs-website/app/api/uploadthing/core.ts
2024-08-27 16:45:36 +05:30

16 lines
480 B
TypeScript

import { createUploadthing, type FileRouter } from "uploadthing/next";
import { UploadThingError } from "uploadthing/server";
const f = createUploadthing();
// const auth = (req: Request) => ({ id: "fakeId" });
export const ourFileRouter = {
imageUploader: f({
"application/zip": { maxFileSize: "8MB" },
}).onUploadComplete(async ({ metadata, file }) => {
console.log("file url", file.url);
}),
} satisfies FileRouter;
export type OurFileRouter = typeof ourFileRouter;