Is there any other methods to upload a file/files to IPFS through a web browser beside using API port 5001

I binded my IPFS server’s local lan IP to IPFS API through the following commands: ipfs config Addresses.API /ip4/ I can upload file through web browser by using the Javascripts codes from

However this method need to expose IPFS API (port 5001) to the network. Exposing IPFS API to outside network is not secure in the real world. My questions is beside uploading file(s) through IPFS API (port 5001), Is there any more secure way to upload file or directory into IPFS (for example through IPFS Gateway, port 8080)? If there is better way to do it, would you please give me some details about how to implement it? Thank you for your comments.

1 Like

I’m currently working on a project called Temporal which exposes an easy to use API for interacting with IPFS nodes and more without exposing access to the underlying IPFS API that runs on port 5001.

You either have to expose direct access to port 5001 and lock it down, or create some sort of API to intercept requests and forward them to the IPFS node.

@postables: My concerns is if we allow people to upload files through API port 5001, the uploaded files will remain in the IPFS blocks system forever and we can’t control these files since we don’t know the files’ hash id. Is there any way we can upload files into IPFS and just allowing them staying in the IPFS temporarily and after certain period of time, these files will be deleted through garbage collect process? Any comments will be highly appreciated. Thanks.


That’s not quite how IPFS works I would recommend reading in more detail about how the system works. You can add files through the API and still have them get GCd.

Check out IpfsCloud:

An online cloud storage service using IPFS which allows a really easy interface that a normal internet user can use.

Read more about it here:


I’ve tried solution by @vasa-develop but it’s not reliable:

I’ve fixed some issues with:

  • curly quotes in code snippets
  • browserified buffer dependency

Stack Overflow question: “How to add a file to IPFS using the API?”

Surely I miss something, it cannot be that difficult.

How to simply upload to IPFS without having my own server?

(serverless architecture)

You can use Infura servers and use ipfs-http-client to connect and upload data to the infura ipfs servers.

Note: The Infura IPFS servers don’t allow to upload big files. I am not sure about the upper limit of the file size, but I have tried it, and it throws error above a certain limit.

Last night I’ve tried using ipfs-http-client Infura:

(the issue contains a super simple code case)

Here is the video illustrating the issue: (loads of links in description)

Despite a few days of effort still didn’t figure it out.

You need to specify the “https” protocol. Try initializing IPFS like this:

var ipfs = ipfsClient('', '5001', { protocol: 'https' })

Getting closer, see the video:


Accessing file gateway seems to take forever.

As I uploaded video, added description, formatted codepen, checked Infura status page, the gateway finally resolved.

Is couple minutes delay expected?

The delay is normal.

BTW, I added a new dedicated server for ipfscloud.
Now you can try this out: