Hi! Is it possible to add custom File properties a...
# prisma-whats-new
m
Hi! Is it possible to add custom File properties at the time that I'm POSTing to the file API endpoint?
This is what my payload looks like:
Copy code
------WebKitFormBoundaryRmGguKpt4WyeHSee
Content-Disposition: form-data; name="data"; filename="headshot.png"
Content-Type: image/png


------WebKitFormBoundaryRmGguKpt4WyeHSee
Content-Disposition: form-data; name="cropWidth"

453
------WebKitFormBoundaryRmGguKpt4WyeHSee
Content-Disposition: form-data; name="cropHeight"

453
------WebKitFormBoundaryRmGguKpt4WyeHSee
Content-Disposition: form-data; name="cropX"

75.5
------WebKitFormBoundaryRmGguKpt4WyeHSee
Content-Disposition: form-data; name="cropY"

0
------WebKitFormBoundaryRmGguKpt4WyeHSee--
n
as far as I know,
filename
and
Content-Type
are accepted. We currently don't support passing in more parameters. If you need additional information for a file, I suggest creating a new type that stores those additional fields, let's say
Image
, and add a one-to-one relation between
File
and
Image
. Then you first upload the file, obtain its id in the response, and create a new
Image
node with the desired information that you can directly connect to the new file node.
m
Ok. I also was able to update that information with a mutation call to the simple API, but your method might be better for other reasons so I'll give it a try later! Thanks!
n
Awesome! 🙂