How to upload file not use S3 Next js? Please, example
file: course.router.ts / import { CourseSchema } from "~/schema/post.schema";
import {
createTRPCRouter,
publicProcedure,
protectedProcedure,
} from "~/server/api/trpc";
import formidable from "formidable";
import fs from "npm";
export const courseRouter = createTRPCRouter({
create: protectedProcedure.input(CourseSchema).mutation(({ ctx, input }) => {
//upload and save here
input.file ////
// throw new TRPCError({ code: "INTERNAL_SERVER_ERROR" });
return ctx.prisma.curse.create({
data: {
name: input.name,
video: input.video,
descriptionCurse: input.descriptionCurse,
},
});
}),
});
3 Replies
this video might help you out: https://youtu.be/mxT3j-5s1Zc
Theo - t3․gg
YouTube
I Fixed File Uploading.
CHECK OUT UPLOADTHING https://uploadthing.com
We were tired of AWS's offerings with S3, and we weren't satisfied by what Cloudflare offered with R2 or even Vercel's Blob offering. I think we have something special here.
GIVE MARK SOME LOVE FOR DEALING WITH MY BS https://twitter.com/r_marked
ALL MY VIDEOS ARE POSTED EARLY ON PATREON https://ww...
did you find any solution?
I recommend using a service like AWS or Cloudflare R2. I've made a very simple example of how you can do this: https://gist.github.com/404-Chacal/ab06162b95b4e3c3675710dfec472e1d .