Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to upload a picture in IPFS

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article shows you how to upload a picture in IPFS, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.

Today, the editor will talk about how to upload and download files in IPFS.

1. Download IPFS software

Download address: https://dist.ipfs.io/#go-ipfs

After opening this address, the web page will automatically select a downloadable version for you according to your current operating system. There are a lot of ipfs-related software downloads on this page. See download go-ipfs, which is the go language version of IPFS. IPFS currently has js version and python version (development has stalled and the team is busy).

two。 Installation

Windows: select a file, unzip the software, then open the command line and navigate to the folder you just saw to execute:

Ipfs help

USAGE:ipfs-Global P2P merkle-dag filesystem....

If you get the above information, congratulations on the successful installation of ipfs.

Mac and Linux: execute tar xvfz go-ipfs.tar.gz to extract the file you just downloaded, then execute:. / go-ipfs/install.sh under the extracted folder, and then install the software, and then:

Ipfs help

USAGE:ipfs-Global P2P merkle-dag filesystem....

By the same token, this also indicates that the installation was successful.

3. Configure ipfs

Execute from the command line:

Ipfs init

The above is the output on Xiaobian's computer, which shows that the initialization configuration of ipfs is complete, and ipfs generates a node id:QmceWUYdX5xjE5zVA3bW1rt4Kq326bm83hRxAkPRe3QWR8. The execution result of each computer will be different. This string represents the ipfs node you are running.

To check the installation, execute:

Ipfs cat / ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme

You will see the following picture:

If you want to learn more about ipfs's commands, you can view them by executing the following command:

Ipfs cat / ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/quick-start

Or visit this page: https://ipfs.io/docs/commands/

4. Node online

Execute the command:

Ipfs daemon

Get the following output:

Congratulations, your IPFS nodes are online. Check that your nodes are linked to those nodes.

Open a new command line window and execute the command:

Ipfs swarm peers

You can see output similar to the following. Congratulations, you can see that your node is connected to other ipfs nodes so far.

5. Upload and download

Note: never upload private files. You don't want your xx photos to stay with this IFPS network for life, do you? The editor is planning to write an article about the protection of personal privacy under IFPS.

PFS core software provides two ways: command line and web.

Command Lin

Command line: download execution

Ipfs cat / ipfs/your_hash > init.jpg ipfs cat / ipfs/your_hash

For example:

Ipfs cat / ipfs/QmdDTor6dWzknFJPJuhJgrUYqd56WkFXYAxyxpEY7kUrEb > init.jpg

This hash value is editor 12.8 in the article "what is IPFS?" (3) "the picture uploaded inside can be downloaded and have a look if you are interested.

Command line: upload

Execute:

Ipfs add init.jpg

Tt-3:go-ipfs tt$ ipfs add init.jpgadded QmdDTor6dWzknFJPJuhJgrUYqd56WkFXYAxyxpEY7kUrEb init.jpg

This will upload a file to the IPFS network, and ipfs add will return a hash value, which is the address of the file on the IPFS network.

Web mode:

Open the browser, type http://localhost:5001/webui in the browser, you can link to your node, the interface is as follows:

This is the basic information of the node running by the editor:

From the picture below, you can see that the editor's machine has connected 385 nodes in the world. From the earth on the left, there are not many nodes in China, most of which are in Europe and the United States.

Then click the Files menu on the left side of the interface, and you can see Select files on the right. This is the function of uploading files provided by the web interface. Just select the file and click upload.

After the addition is completed, there will be an extra hash value in the ALL LOCAL FILES below, that is, the file you just uploaded. If you don't see it, just refresh the web page. Don't shut down your node immediately. Give other nodes some time to cache your file. Once the cache is complete, this file will exist permanently with the IPFS network.

At this time, you can type in the browser: https://ipfs.io/ipfs/ your hash value to see your file, such as: https://ipfs.io/ipfs/QmTYrYEaebR7oxLxkkqGbs8Bmh6xqYBHKew8jN4XQgiiKS, the file that the editor just uploaded.

The above content is how to upload a picture in IPFS. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report