fosslover
fosslover
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
I'll try that {...register('name')} thing right?
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
stuck with image is required no matter what I upload its because what I get from the form is a string not a file
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
so what should I do then?
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
like this
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
that gave me different errors
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
are you getting only the file in the form?
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
https://rentry.co/bpxeb (Spaghetti warning)
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
yeah
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
not the file
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
so if I fail to do that I get C:\fakepath\filename.ext this string in formData["file"]
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
gets the form data inserts a db entry and also uploads the file to supabase storage bucket
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
yup
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
that files is what updated by the onChange handler
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
const onSubmit = async (data: any) => {
let formData = data
// Replacing the file object with the file name
formData["file"] = files![0]
await UploadFile(formData)
callToast()
form.reset()
}
const onSubmit = async (data: any) => {
let formData = data
// Replacing the file object with the file name
formData["file"] = files![0]
await UploadFile(formData)
callToast()
form.reset()
}
this is what my onSubmit does
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
yeah lemme do it
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
now I get why I used onChange handler basically on submit i just get C:\fakepath\filename.ext from the form so I use the onChange handler to get the actual file
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
lemme see what I do with that files thing
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
i did this long ago
97 replies
TTCTheo's Typesafe Cult
Created by fosslover on 7/24/2023 in #questions
Zod File Upload validation
iirc it logged the file path
97 replies