Moralis.File not a function in console error

I tried to create an item and its showing this error below

Uncaught (in promise) TypeError: Moralis.file is not a constructor
    at HTMLButtonElement.createItem (main.js:130)

you can try: new Moralis.File instead of Moralis.file how that error says

Okay let me try it out now

After adding the code, it shows this error in console

Uncaught (in promise) TypeError: item.set is not a function
    at HTMLButtonElement.createItem (main.js:152)

It’s resolved i’ve added some line to it and it works out thanks bro

@cryptokid please help me on this
I am trying to get the alert and the user to see they successfully uploaded their NFT using this below, but i got errors and its not working out the way i want it.

btnCreateItem.onclick = async function btnCreateItem() {
    if (btnCreateItem) {
        document.getElementById("btnCreateItem").onclick = createItem;
        alert("Your NFT is Created Successfully!");
        console.log("Item is uploaded");
        await item.save();
    } else {
        alert("Your NFT is not created");
        console.log("Item Uploading Failed!");
    }
};

you should create different posts for different questions

1 Like