svrjs-nextjs-website/app/api/uploadthing/core.ts

16 lines
485 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;