Skip to content

Demo Interface and usage of the ZeroBit decentralized storage API

License

Notifications You must be signed in to change notification settings

roughpandaz/zerobit-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ZeroBit Browser Example

Upload File Directly from Browser

zerobit

Simply upload a file through a form input. Wait, then the URL and hash will be displayed in a blue box. To see it in action, simply open the index.html file in your browser.

Code

Full Code in folder

$(".upload-btn").on("click", function (e) {
    // Get form data
    var data = new FormData($(".upload")[0]);

    // Create URL
    var url = BASE_PATH + ACCESS_TOKEN_PARAM

    // Request Body
    var uploadSettings = { 
      "url": url, 
      "data": data, 
      "cache": false, 
      "async": true, 
      "processData": false, 
      "contentType": false, 
      "crossDomain": true, 
      "method": 
      "POST", 
      "mimeType": "multipart/form-data"
    }

    // Upload file
    $.ajax(uploadSettings).done(function (response) {
      // Get Response
      resJson = JSON.parse(response)
      // Jquery styling
      console.log(resJson)
    });

About

Demo Interface and usage of the ZeroBit decentralized storage API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published