0

So I am trying to save the image file in firebase database with redux form input but I am getting an error, Data must be an object, but it was: a custom File object till now i tried :

const PictureData = values.attach_picture

and its giving me output as follow

         File {
         name: "zendex.jpeg",
         lastModified: 1564032545425,
         lastModifiedDate: Thu Jul 25 2019 10:59:05 GMT+0530 (India Standard Time),
         webkitRelativePath: "", size: 3498, 
…}

so how to save this as an OBJECT?

Question: How to save an image data as js Object so I can save it in firebase database

DevCo
  • 419
  • 1
  • 3
  • 17

1 Answers1

0

So I had to reCreate a newObject and then set FileData into it

let file = {
    'lastMod'    : values.attach_picture.lastModified,
    'lastModDate': values.attach_picture.lastModifiedDate,
    'name'       : values.attach_picture.name,
    'size'       : values.attach_picture.size,
    'type'       : values.attach_picture.type,
    } 
DevCo
  • 419
  • 1
  • 3
  • 17