If you’re an IPFS user who wants to upload a file or directory to IPFS, Infura has a simple, easy-to-use Upload Client tool to help you do just that.
Once your data is uploaded, you have all the same functionality as if you had uploaded your file normally - you can access it via CID, or if you’ve uploaded a directory, you can access it with its CID and “browse” within the directory by providing a path to reach a sub-folder or file.
Let’s get into it! If you go to the Upload Client tool’s repo, you can see you have four options for customization:
--id
(your Project ID from your Infura dashboard - instructions on accessing it below)
--secret
(your Project Secret from your Infura dashboard - instructions on accessing it below)
--pin
(whether you would like to pin your file to IPFS - this defaults to “true” and will rarely need to be updated)
--url
(the URL you are uploading to - this defaults to “https://ipfs.infura.io:5001” and will rarely need to be updated)
To get the --id
and --secret
, you have two options:
Option One:
Find your IPFS project in your Infura dashboard and hit the “SETTINGS” button on the right of the project - super simple!
Option Two:
Find your IPFS project in your Infura dashboard and select the IPFS project you are going to be using to upload your files. Once you’re in the project, go into the “PROJECT SETTINGS” tab from the top menu.
Inside your settings under the “KEYS” section, you will find both your Project ID and Project Secret to use in the command.
To use the tool, simply clone this repo and follow the instructions both in the repo and below. You can install the tool via the pre-compiled binaries listed in the latest release page or you can simply run git clone
and then go build
, which will create the binary in your project’s folder. Once you have that installed, simply run the below command in your terminal:
./ipfs-upload-client --id <project_id> --secret <project_secret> /path/to/data
Once you’ve done that, you should get a printout of your hash in an “ipfs” directory, like so:
/ipfs/QmaN7KeH6g6WKuGNKxUNFwdG6qUXsRkHxJiiKQ5tdNarqt
This shows that you have successfully uploaded your files to Infura’s IPFS endpoint. You can access your files via your dashboard, under your IPFS project.
If you want more information on accessing your files, you can check out our other IPFS tutorial here!
Happy uploading!