@cryptokid I did the below. But now I’m getting “Uncaught (in promise) Error: Invalid session token at handleError (moralis.js?_=1637580775296:25228)”
// upload image
$( "#upload-image" ).change( async function() {
var selected = $( this )[0].files.length;
if ( ! selected ) return false;
//Start. Implementing Moralis SDK way
$.getScript('https://cdn.jsdelivr.net/npm/[email protected]/dist/web3.min.js', async function() {
$.getScript('https://unpkg.com/moralis/dist/moralis.js', async function() {
// connect to Moralis server
Moralis.initialize("o9YG2udd965.....Pd....oKPA");
Moralis.serverURL = "https://e8b....qaf.usemoralis.com:2053/server";
const user = Moralis.User.logIn("qwe100", "mHCsfsdf");
// Save file input to IPFS
const data = $('#upload-image').get(0).files[0]
const file = new Moralis.File(data.name, data)
await file.saveIPFS();
console.log(file.ipfs(), file.hash());
});
});