Skip to content

Commit

Permalink
include file info in onUploadComplete in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
t3dotgg committed May 11, 2023
1 parent e08cfdf commit 13148a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/src/pages/nextjs/appdir.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ export const ourFileRouter = {
// Whatever is returned here is accessible in onUploadComplete as `metadata`
return { userId: user.id };
})
.onUploadComplete(async ({ metadata }) => {
.onUploadComplete(async ({ metadata, file }) => {
// This code RUNS ON YOUR SERVER after upload
console.log("Upload complete for userId:", metadata.userId);

console.log("file url", file.url);
}),
} satisfies FileRouter;

Expand Down
4 changes: 3 additions & 1 deletion docs/src/pages/nextjs/pagedir.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ export const ourFileRouter = {
// Whatever is returned here is accessible in onUploadComplete as `metadata`
return { userId: user.id };
})
.onUploadComplete(async ({ metadata }) => {
.onUploadComplete(async ({ metadata, file }) => {
// This code RUNS ON YOUR SERVER after upload
console.log("Upload complete for userId:", metadata.userId);

console.log("file url", file.url);
}),
} satisfies FileRouter;

Expand Down

1 comment on commit 13148a1

@vercel
Copy link

@vercel vercel bot commented on 13148a1 May 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.