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

Add doesn't work in safari #426

Closed
nycoliver opened this issue Nov 15, 2016 · 2 comments
Closed

Add doesn't work in safari #426

nycoliver opened this issue Nov 15, 2016 · 2 comments

Comments

@nycoliver
Copy link

First of all, awesome work on and thank you for ipfs/js-ipfs#429!! πŸŽ‰

I noticed an issue in Safari. When I try to add a file, I get an error:

getFilesStream β€” get-files-stream.js:100 ReferenceError: Can't find variable: Multipart

Works fine in Chrome and Firefox. Code to reproduce below. I can upload the whole repo if that helps. Please forgive the react boiler plate!

import React, { Component } from 'react';
import './App.css';

import IpfsAPI from 'ipfs-api';
const ipfs = IpfsAPI();

class App extends Component {

  render() {
    return (
      <div className="App">
        <p className="App-intro">
          Choose a file to add.
        </p>
        <input className="picker" id='file' type="file"></input>
        <button id="store" onClick={this.add}>Add to ipfs</button>
        <p>
        </p>
      </div>
    );
  }

  add() {
    const file = document.getElementById('file').files[0]
     const reader = new FileReader()
     reader.onload = function () {
       var toStore = new Buffer(reader.result);
       ipfs.add(toStore, function (err, res) {
         if (err || !res) {
           return console.error('ipfs add error', err, res)
         }

         res.forEach(function (file) {
           console.log('successfully stored', file)
         })
       })
     }
     reader.readAsArrayBuffer(file)
  }
}

export default App;
@dignifiedquire
Copy link
Contributor

Thank you for the report, will need to investigate.

@daviddias
Copy link
Contributor

Everything should work now! :) js-ipfs is now fully supported (and js-ipfs-api is not doing anything more fancy than js-ipfs) https://twitter.com/daviddias/status/926430950183010309

@ghost ghost removed the ready label Nov 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants