File Upload to IPFS issue

fileData = new Moralis.File(name, fileUrl);
console.log(fileData ${fileData});
res = await fileData.saveIPFS();
console.log(res ${res});
imageFileUrl = res.ipfs();

is the code snippet.
It seems Moralis.File is causing issue
We are using Moralis v1.0

File upload to IPFS is failing suddenly?
It was working fine till few hours back.

Is it due to Moralis V1.0
or IPFS issue is there?
Can folder upload resolve my issue?

you could try to use uploadFolder as an alternative

we will check this issue

Is it due to Moralis 1.0?

no, it is not related to moralis v1, can you try again now?

No.
Issue is still persisiting, API is throwing 400 for some reason.

yes, it is still not working as expected

Any timestamp by when it can be fixed?

All this functionality is working with your old server it’s only issue with parse server

what you mean with working with old server?
for me it doesn’t work with a moralis server now, unless I used web3api with uploadFolder

@IamRohit, @Waqar-7 it should work again now

same issue not working with parse server

What happens?
Can you use web3api uploadFolder function?

No how to use this I am using the previous code and geeting issue from yesterday no what to change please check I have provided the code

async function uploadArtToIPFS() {

try {

await nft.saveIPFS();

console.log(nft);

let nftPath = nft.ipfs();

console.log(nftPath);

uploadMetaDataToIPFS(nftPath);

} catch (err) {

console.log(err);

alert("Error saving art to ipfs");

$('#saveToIPFSBtn').prop('disabled', false);

$('#saveToIPFSBtn').html("Upload and Mint");

}

};

async function uploadMetaDataToIPFS(nftPath) {

$(’#saveToIPFSBtn’).html(`Uploading metadata to IPFS

                          <span class="sr-only">Loading...</span>

                        </div>`);

try {

let allEmojiRegEx = /\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]/g;

const metadata = {

  name: $('#title').val().replace(allEmojiRegEx, ''),

  description: $('#descriptionInput').val().replace(allEmojiRegEx, ''),

  image: nftPath

}

console.log(metadata);

const nftMetadata = new Moralis.File("nft-metadata.json", { base64: btoa(JSON.stringify(metadata)) });

console.log(nftMetadata);

await nftMetadata.saveIPFS();

console.log(nftMetadata);

let nftMetadataPath = nftMetadata.ipfs();

console.log(nftMetadataPath);

mint(nftMetadataPath, nftPath);

} catch (err) {

console.log(err);

alert("Error saving metadata to ipfs");

$('#saveToIPFSBtn').prop('disabled', false);

$('#saveToIPFSBtn').html("Upload and Mint");

}

};

Can you try to look on how to post code on forum?

It is not readable in current form that is posted.

async function uploadArtToIPFS() {

  try {

    await nft.saveIPFS();

    console.log(nft);

    let nftPath = nft.ipfs();

    console.log(nftPath);

    uploadMetaDataToIPFS(nftPath);

  } catch (err) {

    console.log(err);

    alert("Error saving art to ipfs");

    $('#saveToIPFSBtn').prop('disabled', false);

    $('#saveToIPFSBtn').html("Upload and Mint");

  }

};

async function uploadMetaDataToIPFS(nftPath) {

  $('#saveToIPFSBtn').html(`Uploading metadata to IPFS <div class="spinner-border spinner-border-sm text-light" role="status">

                              <span class="sr-only">Loading...</span>

                            </div>`);

  try {

    let allEmojiRegEx = /\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]/g;

    const metadata = {

      name: $('#title').val().replace(allEmojiRegEx, ''),

      description: $('#descriptionInput').val().replace(allEmojiRegEx, ''),

      image: nftPath

    }

    console.log(metadata);

    const nftMetadata = new Moralis.File("nft-metadata.json", { base64: btoa(JSON.stringify(metadata)) });

    console.log(nftMetadata);

    await nftMetadata.saveIPFS();

    console.log(nftMetadata);

    let nftMetadataPath = nftMetadata.ipfs();

    console.log(nftMetadataPath);

    mint(nftMetadataPath, nftPath);

  } catch (err) {

    console.log(err);

    alert("Error saving metadata to ipfs");

    $('#saveToIPFSBtn').prop('disabled', false);

    $('#saveToIPFSBtn').html("Upload and Mint");

  }

};

With a self hosted parse server you ca. create a cloud function that receives a buffer in base64 and uploads it to IPFS.

You can use uploadFolder function in that cloud function

can you share the cloud function code of upload Folder

uploadFolder is a function in web3api, you can test it directly in the docs interface too