What is the recommended way of handling image uploads in a form that supports both adding and editing with zod? #10091
Unanswered
its-monotype
asked this question in
Q&A
Replies: 2 comments 3 replies
-
The recommended solution to handle image upload is to use pre-signed url (AWS S3 service or similar service) which generates upload url to upload the image file and download url to be set inside form values. For example:
In case your existing application cannot change to this solution, you still can simplify the image handling by keep image field as string then transform target image from |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is the recommended way of handling image uploads in a form that supports both adding and editing of a product? Here is my current implementation with two options, is there any suggestion to improve it?
Here is the first option when an image converts to the File object and sets it as the default value for the image in the form:
OR
Here is the second option when I created two schemas for creating and updating products and in the update schema image is optional:
Beta Was this translation helpful? Give feedback.
All reactions