Getting error while upload file to IPFS

When trying to upload image to IPFS i was getting

core.js:6456 ERROR Error: Uncaught (in promise): ParseError: 130 File upload by public is disabled.
Error: File upload by public is disabled.
    at handleError (moralis.js:22435)
    at ZoneDelegate.invoke (zone.js:372)
    at Object.onInvoke (core.js:28673)
    at ZoneDelegate.invoke (zone.js:371)
    at Zone.run (zone.js:134)
    at zone.js:1276
    at ZoneDelegate.invokeTask (zone.js:406)
    at Object.onInvokeTask (core.js:28660)
    at ZoneDelegate.invokeTask (zone.js:405)
    at Zone.runTask (zone.js:178)
    at resolvePromise (zone.js:1213)
    at zone.js:1120
    at asyncGeneratorStep (asyncToGenerator.js:6)
    at _throw (asyncToGenerator.js:29)
    at ZoneDelegate.invoke (zone.js:372)
    at Object.onInvoke (core.js:28673)
1 Like

Hey @Aman

Take a look at

Sorry but but i am trying to upload image in IPFS using angular not on cloud function.
Here is my code

Moralis.initialize("ID");
Moralis.serverURL = url'; 

await Moralis.Web3.enable();

async upload()
{

const object = {
    "key" : "value"
  }
const file = new Moralis.File("file.json", {base64 : btoa(JSON.stringify(object))});
await file.saveIPFS();
}

Are you logged in to Moralis when you try to execute that code?

Hi,

Got same error: “Error: File upload by public is disabled.”.

Solved it by (principe):

const serverUrl = "...";
const appId = "...";
Moralis.start({ serverUrl, appId });
console.log('Moralis: ', Moralis)
Moralis.authenticate()
//var user = Moralis.User.current(); // optional
//console.log('User: ', user)

$('#saveImageToIPFS').click(async () => {
  try {
    var imageFile = $('#inputImagefile')[0].files[0];
    console.log('saveImageToIPFS: file:', imageFile)
    console.log('saveImageToIPFS: file.name:', imageFile.name)

    const file = new Moralis.File(imageFile.name, imageFile);
    await file.saveIPFS();
    console.log('ipfs=' + file.ipfs())
    console.log('hash=' + file.hash())

  } catch(err) {
    console.log('saveImageToIPFS ERROR: ' + err)
  }
})

with HTML code:

<input type="file" class="form-control-file" id="inputImagefile">
<button type="button" id="saveImageToIPFS" class="btn btn-Success">Save image to IPFS</button>

A user needs to be logged-in in order to upload to ipfs

2 Likes

const uploadImage = async () => {
var nftImageFile = new Moralis.File(‘FILE_NAME’, file);
await nftImageFile.saveIPFS();
return nftImageFile.ipfs();
};

Suddenly it’s broken. so can’t upload the image to IPFS in react. got 400 error.

It looks like it is an issue on our side

Yeah, I hope fix this issue asap.

Facing the same issue- Moralis IPFS upload shows error: Request failed with status code 400

@eugene, @pushpit07, it should be fixed now

2 Likes

Moralis file upload is not working for now.
Suddenly it is happening, getting internal server error

  1. code: 130
  2. error: “Internal Server Error”

yes, we are investigating

1 Like

it should work again now

1 Like