Closed JRichens closed 1 month ago
well the short answer is you can't, cause for client-side uploads the file never hits your server. your server is only used to request presigned urls in a secure manner. so if you wanna preprocess the file, you'd do that on the client, for example in the onBeforeUploadBegin
callback
if you wanna do this, you'd need to use server-side uploads. Submit the file to your server, do your thing and use utapi.uploadFiles
to upload the compressed image.
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.
Describe the feature you'd like to request
api/uploadthing/core.ts
// FileRouter for your app, can contain multiple FileRoutes export const ourFileRouter = { // Define as many FileRoutes as you like, each with a unique routeSlug imageUploader: f({ image: { maxFileSize: "8MB" } }) // Set permissions and file types for this FileRoute .middleware(async ({ req }) => { // This code runs on your server before upload const user = await auth(req) // explain here
Explain here how to compress an image and resize it before uploading
Describe the solution you'd like to see
Add to the documentation suggested ways of compressing / resizing
Additional information
No response
๐จโ๐งโ๐ฆ Contributing