[bug]: Cant Upload Zip File
Samz0001 opened this issue · 4 comments
I understand that this issue may be closed if it should be filed in another category
- I understand
My issue
<Label>Product File</Label>
<UploadDropzone
endpoint="productFileUpload"
onClientUploadComplete={(res) => {
setProductFile(res[0].url);
}}
onUploadError={(error: Error) => {
throw new Error(`${error}`);
}}
/>
{state?.errors?.["productFile"]?.[0] && (
<p className="text-red-500">
{state?.errors?.["productFile"]?.[0]}
</p>
)}
//core.ts
import { getKindeServerSession } from "@kinde-oss/kinde-auth-nextjs/server";
import { createUploadthing, type FileRouter } from "uploadthing/next";
import { UploadThingError } from "uploadthing/server";
const f = createUploadthing();
export const ourFileRouter = {
imageUploader: f({ image: { maxFileSize: "4MB", maxFileCount: 5 } })
.middleware(async ({ req }) => {
const { getUser } = getKindeServerSession();
const user = await getUser();
if (!user) throw new UploadThingError("Unauthorized");
return { userId: user.id };
})
.onUploadComplete(async ({ metadata, file }) => {
console.log("Upload complete for userId:", metadata.userId);
console.log("file url", file.url);
return { uploadedBy: metadata.userId };
}),
productFileUpload: f({
"application/zip": { maxFileSize: "4MB", maxFileCount: 1 },
})
.middleware(async ({ req }) => {
const { getUser } = getKindeServerSession();
const user = await getUser();
if (!user) throw new UploadThingError("Unauthorized");
return { userId: user.id };
})
.onUploadComplete(async ({ metadata, file }) => {
console.log("Upload complete for userId:", metadata.userId);
console.log("file url", file.url);
return { uploadedBy: metadata.userId };
}),
} satisfies FileRouter;
export type OurFileRouter = typeof ourFileRouter;
What errors are you getting?
This issue has been automatically marked as stale because it has not had any activity for 10 days. It will be closed in 5 days if no further activity occurs.
This issue has been closed because it has not had any activity for 5 days since being marked as stale.
What errors are you getting?
I know what project he was working and I am facing the same! There is no error at all main problem occurring here is that after user clicks the upload btn, selecting it , selects it and gets out of explorer window nothing happens! The file doesn't get uploaded. Even more it doesn't even get selected! and hence no upload happens! Here are step by step images what happens>>>
And below are the ss of the Product Images Uploader section:
Here the images are getting uploaded successfully