Skip to content
Branch: master
Find file History
hugomrdias and alanshaw feat: add support for File DOM API to files-regular (#986)
* feat: add file dom api support to files api

* feat: add support for File DOM API to files-regular

* chore: fix package declaration cause npm is dumb

* chore: fix lint

* chore: add ipfs-utils

* fix: change the requires to ipfs-utils

* chore: increase max bundle size
Latest commit 7b49f7e May 16, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
src
.gitignore feat: add support for File DOM API to files-regular (#986) May 16, 2019
README.md chore(examples): fix screenshot Dec 3, 2018
index.html Example: Upload file to IPFS via browser w/ React & Webpack (#539) Mar 24, 2017
package.json feat: add support for File DOM API to files-regular (#986) May 16, 2019
screenshot.png Example: Upload file to IPFS via browser w/ React & Webpack (#539) Mar 24, 2017
webpack.config.js feat: add support for File DOM API to files-regular (#986) May 16, 2019

README.md

Upload file to IPFS via browser using js-ipfs-http-client

In this example, you will find a simple React app to upload a file to IPFS via the browser using js-ipfs-http-client and Webpack.

Setup

As for any js-ipfs-http-client example, you need a running IPFS daemon, you learn how to do that here:

Note: If you load your app from a different domain than the one the daemon is running (most probably), you will need to set up CORS, see https://github.com/ipfs/js-ipfs-http-client#cors to learn how to do that.

A quick (and dirty way to get it done) is:

> ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"*\"]"
> ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials "[\"true\"]"

Run this example

Once the daemon is on, run the following commands within this folder:

> npm install
> npm start

Now open your browser at http://localhost:3000

After uploading a file (left screen), and opening the uploaded file (right screen), you should see something like:

App Screenshot

You can’t perform that action at this time.