Moralis saved IPFS files with restricted format

Hey guys, so we want to actually upload only a specific extension file in our dApp. We’ve checked Moralis Doc and you can actually specify extension for moralis to handle the filetype acccordingly, but is there a way to restrict only a specific typefile to be uploaded?

You can restrict in the frontend

…hhmm, not as good as we want to. I mean we can use the “accept” field on HTML and a function to parse and match to desired extension, but that does not solve the issue of an user getting a whatever file, change extension name, and upload it.

You can define a beforeFileSave trigger and check the extension name there.
Check: https://docs.moralis.io/moralis-server/triggers#beforesavefile

2 Likes