From 13148a189b73a14fa930c4110daf0b883489444e Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 11 May 2023 02:58:08 -0700 Subject: [PATCH] include file info in onUploadComplete in examples --- docs/src/pages/nextjs/appdir.mdx | 4 +++- docs/src/pages/nextjs/pagedir.mdx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/src/pages/nextjs/appdir.mdx b/docs/src/pages/nextjs/appdir.mdx index cbc3561dc3..de7072112a 100644 --- a/docs/src/pages/nextjs/appdir.mdx +++ b/docs/src/pages/nextjs/appdir.mdx @@ -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; diff --git a/docs/src/pages/nextjs/pagedir.mdx b/docs/src/pages/nextjs/pagedir.mdx index 2a98448ada..31c10ca991 100644 --- a/docs/src/pages/nextjs/pagedir.mdx +++ b/docs/src/pages/nextjs/pagedir.mdx @@ -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;