# Problem with file upload to ipfs / hash /path

**URL:** <https://discuss.ipfs.tech/t/problem-with-file-upload-to-ipfs-hash-path/7669>\
**Category:** Help\
**Created:** [April 7, 2020, 4:57pm UTC](https://discuss.ipfs.tech/t/problem-with-file-upload-to-ipfs-hash-path/7669 "2020-04-07T16:57:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhgromov](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/zhgromov/32/3662_2.png) [@zhgromov](https://discuss.ipfs.tech/u/zhgromov)\
**Post date:** [April 7, 2020, 4:57pm UTC](https://discuss.ipfs.tech/t/problem-with-file-upload-to-ipfs-hash-path/7669/1 "2020-04-07T16:57:31Z")

</div>

Hello, guys.  
Few month ago I add ipfs for upload files, all worked correctly, but a week ago I have problem and can’t resolve it.  
I try to send file to IPFS and get hash of file.

like this.  
connect ipfs :

```
  ipfs = await Ipfs.create({
      config: {
        Bootstrap: [
          '/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
          '/dns4/lon-1.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3',
          '/dns4/sfo-3.bootstrap.libp2p.io/tcp/443/wss/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM',
          '/dns4/node0.preload.ipfs.io/tcp/443/wss/ipfs/QmZMxNdpMkewiVZLMRxaNxUeZpDUb34pWjZ1kZvsd16Zic',
          '/dns4/node1.preload.ipfs.io/tcp/443/wss/ipfs/Qmbut9Ywz9YEDrz8ySBSgWyJk41Uvm2QJPhwDJzJyGFsD6'
        ]
      }
    });

    console.timeEnd('IPFS Started');

```

and try to send file

```
  const {ipfs, ipfsInitError} = useIpfs({commands: ['id']});
  const addToIpfs = async (file) => {
    const hashOfFile = await ipfs.add(file);

    return hashOfFile[0].path;
};

```

so, when I try to upload, I have error

> Unhandled Rejection (TypeError): undefined is not an object (evaluating ‘hashOfFile[0].path’)

in hashOfFile return function  
AsyncGenerator {\_invoke: function, next: function, throw: function, return: function, Symbol(Symbol.asyncIterator): function}

earlier it was hash of file.

could you help me?

---

<div class="post-metadata">

**Author:** ![zhgromov](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/zhgromov/32/3662_2.png) [@zhgromov](https://discuss.ipfs.tech/u/zhgromov)\
**Post date:** [April 8, 2020, 11:46am UTC](https://discuss.ipfs.tech/t/problem-with-file-upload-to-ipfs-hash-path/7669/2 "2020-04-08T11:46:44Z")

</div>

on GitHub I have answer

> ```
> Previously ipfs.add returned an array, which was great, unless you were adding a lot of files in which case your process could run out of memory. Now it returns an async iterator as you've found.
> 
> ```
> 
> n.b. you don’t need to do the double await:

```auto
// instead of
for await (const inputFile of await ipfs.add({ path: 'randompath.txt', content: file })) {

// do:
for await (const inputFile of ipfs.add({ path: 'randompath.txt', content: file })) 

```

it work, but still problem in Safari - crash

```auto
    Unhandled Rejection (TypeError): null is not an object (evaluating 'ipfs.add')

```

 ![Снимок экрана 2020-04-08 в 14.46.18](https://us1.discourse-cdn.com/flex020/uploads/ipfs1/original/2X/c/cf5a776fd7e32c9a07fe5c87d2a331c1148dda90.png)
