Multiple files in an object

Hello Guys :vulcan_salute:

Is there a way to put multiple files in an object ?

Right now I’m doing this:

...
let filesArray
this.imageFile.forEach((imgFile) => {
  const ext = imgFile.name.split('.').pop()
  const image = new this.$Parse.File(`${this.editedItem.serialNumber}.${ext}`, imgFile)
  filesArray.push(image)
})

const new myObject = new Parse.Object('objectName')
myObject
  .set('image', filesArray)
  .save()
...

But In the Dashboard what I’m watching is:
[{
“__type”: “File”,
“name”: “5371c5_1.jpg”,
“url”: “https://domain.com/llXwob/5371c5_1.jpg
}, {
“__type”: “File”,
“name”: “9fcaac_1.png”,
“url”: “https://domain.com/llXwob/9fcaac_1.png
}]

Thanks

It’s normal, dashboard do not parse types inside arrays but when you retrieve some data you can use:

myObject.get('image').forEach(image => console.log('My Url', image.url))
OR
myObject.get('image').forEach(image => console.log('My Url', image.url()))

One of them should work

1 Like