Ipfs question, moralis server

ipfs question, for the self-hosted server, what would be the syntax to upload ipfs, this is the one I had, it didn’t work for me:

>  const file: any = await new Moralis.File(
>            "avatarCollect.jpg",
>            values.theFile
>          );
> 
>          await file.saveIPFS();
>          const filePath = await file.ipfs();
>          const fileHash = await file.hash();
> 
>          console.log('filePath', filePath)
>          console.log('fileHash', fileHash)

Hi @davidzuccarini

You can use the Upload folder API for uploading to IPFS. Morlais.File dont work with self host.

I have this in the front, but it worked with the back end of moralis, and I use it from const { Moralis}: any = useMoralis();

to change the api, I don’t see more documentation, how can I extract the hash, the patch, if it is an individual file, what is the syntax, thank you very much, and thanks for the time.

You will get in return an ipfs path that contains the hash. You can try it directly in docs interface to see the output.

1 Like