Created
April 11, 2021 23:28
-
-
Save rollodex/3a0c6a5e7d107f0a8135734b7c72c405 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reader.readAsDataURL(input.files[0]); | |
var formData = new FormData(); | |
formData.append('file', input.files[0]); | |
var xhr = new XMLHttpRequest(); | |
xhr.open('POST', 'https://ipfs.infura.io:5001/api/v0/add'); | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState == XMLHttpRequest.DONE) { | |
alert(xhr.responseText); | |
var resp = JSON.parse(xhr.responseText) | |
ipfsHash = resp['Hash']; | |
} | |
} | |
xhr.send(formData); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment