Hi my Name is Nicola i have problems create the URL IPS with Moralis\
<!-- Moralis SDK code -->
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script>
<script src="https://unpkg.com/moralis/dist/moralis.js"></script>
<h1>IPFS Demo</h1>
<button id="btn-login">Login</button><br><br>
<input type="text" name="metadataName" id="metadataName" placeholder="name"><br>
<textarea name="metadataDescription" id="metadataDescription" cols="30" rows="10"></textarea><br>
<input type="file" name="fileInput" id="fileInput"><br><br>
<button onclick=go()>GO</button>
<script>
// connect to Moralis server
const serverUrl = "https://3x39a289mxzd.usemoralis.com:2053/server";
const appId = "XEK6EPv5H5ztG8yAgNJTCwI3tIhwxaE1TPWUuJxg";
Moralis.start({ serverUrl, appId });
//Loghin function
login = async () => {
Moralis.Web3.authenticate().then(function (user) {
console.log('logged in');
})
}
//Uplode ad image
uploadImage = async () => {
const data = fileInput.files[0]
const file = new Moralis.File(data.name, data)
await file.saveIPFS();
console.log(file.ipfs(), file.hash());
return file.ipfs();
}
//Uplode metadata object
uploadMetadata = async (imageURL) => {
const name = document.getElementById('metadataName').value;
const description = document.getElementById('metadataDesription').value;
const metadata = {
"name": name,
"description":description,
"image": imageURL
}
const file = new Moralis.File("file.json", {base64 : btoa(JSON.stringify(metadata))});
await file.saveIPFS();
console.log(file.ipfs());
}
//function to GO biotton
go = async () => {
const image = await uploadImage();
await uploadMetadata(image)
}