-
Problem DescriptionI'm trying to implement a file upload feature in a Next.js server component using Code Example"use server";
import { action } from "@/lib/safe-action";
import { zfd } from "zod-form-data";
const schema = zfd.formData({
image: zfd.file(),
});
export const fileUploadAction = action
.schema(schema)
.action(async ({ parsedInput }) => {
await new Promise((res) => setTimeout(res, 1000));
// Do something useful with the file.
console.log("fileUploadAction ->", parsedInput);
return {
ok: true,
};
}); Error Message
Environment
AnalysisIt seems that QuestionHow can I fix this issue to properly handle file uploads in a Next.js server component? Is there an alternative method or configuration I should be using? Additional InformationAny insights or suggestions would be greatly appreciated. If you need any more information about my setup or have encountered a similar issue, please let me know. Thank you in advance for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, are you on Node 18? Please take a look at: |
Beta Was this translation helpful? Give feedback.
Hi, are you on Node 18? Please take a look at: