You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I'm trying to update/create a resource with uploader that has multiple: true option it will not save the photos into the database record
Possible issue source
After some research I found that with multiple: true params are stored in variant: { 'photos.bucketKey.0': 'kjgiqh23pib4h2b34jh234', 'photos.name.0': 'picture.png' }
Meaning 0 is placed at the end, so unflatten creates from it the following object: { photos: { bucketKey: ['kjgiqh23pib4h2b34jh234'], name: 'picture.png' } }
But running update on typeorm repository will throw following error: QueryFailedError: cannot get array length of a non-array
I think it's the case why its not working
Possible solution
Replace the form of multiple files handling into: { 'photos.0.bucketKey': 'kjgiqh23pib4h2b34jh234', 'photos.0.name': 'picture.png' } (zeros are placed in the middle)
You should change the datatype of field storing address of images. When you store multiple images, it uploaded in the form of array.
So, change the definition of your table and make sure the column store following datatype
image_url text[],
If you are using any ORM like prisma to build models, use
Description
When I'm trying to update/create a resource with uploader that has
multiple: true
option it will not save the photos into the database recordPossible issue source
After some research I found that with multiple: true params are stored in variant:
{ 'photos.bucketKey.0': 'kjgiqh23pib4h2b34jh234', 'photos.name.0': 'picture.png' }
Meaning 0 is placed at the end, so unflatten creates from it the following object:
{ photos: { bucketKey: ['kjgiqh23pib4h2b34jh234'], name: 'picture.png' } }
But running update on typeorm repository will throw following error:
QueryFailedError: cannot get array length of a non-array
I think it's the case why its not working
Possible solution
Replace the form of multiple files handling into:
{ 'photos.0.bucketKey': 'kjgiqh23pib4h2b34jh234', 'photos.0.name': 'picture.png' }
(zeros are placed in the middle)Environment
adminjs: 5.2.1
@adminjs/upload: 2.0.1
@adminjs/typeorm: 2.0.0
typeorm: 0.2.36
postgresql: 13.3
The text was updated successfully, but these errors were encountered: