Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Create example: uploading binary file via browser form "file upload" #316

Closed
@harlantwood

Description

@harlantwood

Below are notes from my post to a thread on ipfs-users:

I wrestled with this one for a while, trying to upload images to IPFS from the browser. It's a bit tricky.

Here is a gist of a simplified version of the working solution that I ended up with:

https://gist.github.com/harlantwood/58990ebe47b54e05020a13a45a124dff

This example is in ES6 / React, but all the important stuff should work in other contexts.

Important note: I had to require buffer directly -- using IpfsApi.Buffer did not work for me, maybe because of a version difference, not sure. And yes you need the trailing slash:

Buffer = require('buffer/').Buffer

Otherwise you will get the nodejs built in buffer.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions