[SOLVED] Web3API.storage IPFS upload

Hi, I am trying to upload files successfully to ipfs so an image and some metadata with it. My problem is that I would like to upload them at the same location (in other words with the same hash)
But right now I am not sure how to make this because I am getting my json data basically uploaded to
https://ipfs.moralis.io:2053/ipfs/firstHash/myfiles/test.json
and https://ipfs.moralis.io:2053/ipfs/secondHash/myfiles/test.jpg for instance
The documentation says upload “Uploads multiple files and place them in a folder directory. Returns path (asynchronous).” so I believe there is a way to do it right? Anyone knows?

  const options = {
    abi: [
      {
        path: "myfiles/event.png",
        content: {
          name : 'test',
          description : 'car data'
        }
      },
    ],
  };
  const testAPI = async () => {
    const path = await web3Api.storage.uploadFolder(options)
    console.log(path);
  }

EDIT: Nevermind there was an error in my code that’s why it did not work but yes basically for people interested you just put multiple objects in your abi so something like this:


const options = {
    abi: [
      {
        path: "moralis/test.png",
        content: {
          imageData : 'whatever'
      }
    },
    {
      path : "moralis/test.json",
      content: {
        eventName: 'oktest',
        description : 'lezgo',
      }
    }
    ],
  };

You will get the same hash for both

1 Like