Lädt...


🔧 File Upload with Pinata’s Files API


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

This is a submission for the The Pinata Challenge

What I Built

I built a File Upload Application that leverages Pinata’s Files API to upload files to IPFS (InterPlanetary File System) and Pinata’s CDN. The application provides a seamless file-driven user experience, allowing users to upload images, documents, or any file type. Once uploaded, users can access the files via IPFS through a Pinata gateway link.

The project includes:

  • Creativity: Handling various file types and giving users direct links to view their uploaded files on IPFS.
  • Performance: Utilizing Pinata’s CDN to serve files quickly.
  • Use of Underlying Technology: Using Pinata SDK to handle file uploads and Express.js for the backend.
  • Usability and User Experience: Simple HTML interface with minimal input for users.
  • Accessibility: User-friendly interface that allows easy interaction with the application.

Demo

Check out the live demo of the application:
Click here to try Live Demo Link

Screenshot:
File Upload Form
File Upload with Pinata's API
After the file is uploaded successfully click on the "UPLOAD ANOTHER FILE" button to upload more files
File Upload with Pinata's API

My Code

You can view the complete source code of the project on GitHub:

git clone https://github.com/yourusername/pinata-file-upload-app.git

More Technical Details

1. File Upload: Users can upload any file (images, documents, videos, etc.) through a simple HTML form. Once a file is selected and submitted, the backend (built with Node.js) uses the Pinata SDK to upload the file.

const { PinataSDK } = require("pinata-web3");

const pinata = new PinataSDK({
    pinataJwt: process.env.PINATA_JWT, 
    pinataGateway: process.env.PINATA_GATEWAY
});

async function fileUpload() {
    try {
        const file = new File(["Hello Pinata"], "TestFile.txt", { type: "text/plain" });
        const uploadResponse = await pinata.upload.file(file);
        console.log(uploadResponse); 
    } catch (error) {
        console.log(error);
    }
}

fileUpload();

This will return an object like the following

{
  IpfsHash: 'bafybeifmho6bs7aals5mui6x2qiz2b6ndjeob2e27v4o4fqyobarelpeku',
  PinSize: 336015,
  Timestamp: '2024-10-07T10:36:01.759Z'
}

2. CDN Integration: Once a file is successfully uploaded, the application generates a link using Pinata’s CDN (Content Delivery Network) gateway, allowing users to access their files via a fast and reliable service. This enhances performance, especially for large files.

  • Example of a file access link: https://gateway.pinata.cloud/ipfs/YourFileHash

You can check out Pinata official documentation for more details.

Conclusion

Building this File Upload Application with Pinata's API provided valuable insights into leveraging decentralized storage systems. By combining IPFS with Pinata’s CDN, I was able to create a fast, reliable solution for uploading and accessing various file types. This project highlights the potential of decentralized technology in enhancing file accessibility and performance.

Looking ahead, I'm excited to continue exploring the capabilities of Pinata and IPFS to develop even more powerful decentralized applications.

...

🔧 Pinata OG! | Generate beautiful OpenGraph Images with Pinata File API


📈 49.58 Punkte
🔧 Programmierung

🔧 Pinata OG! | Generate beautiful OpenGraph Images with Pinata File API


📈 49.58 Punkte
🔧 Programmierung

🔧 The Pinata Challenge: Pinata File Hub - Seamless File Management & Uploads


📈 48.07 Punkte
🔧 Programmierung

🔧 Pinata CLI: A CLI Application for the Pinata.Cloud Files Interface


📈 47.24 Punkte
🔧 Programmierung

🔧 File Upload with Pinata’s Files API


📈 41.8 Punkte
🔧 Programmierung

🔧 Laveraging Pinata API to upload files


📈 38.19 Punkte
🔧 Programmierung

🔧 FileShare| A FileSharing Platform built using Next.js and Pinata Files API


📈 31.93 Punkte
🔧 Programmierung

🔧 Fun With Files - Time Capsule Submission for the Pinata Challenge


📈 26.82 Punkte
🔧 Programmierung

🔧 Mintr - Open NFT tools with Pinata upload


📈 26.68 Punkte
🔧 Programmierung

🔧 Introducing PinataNET: A Simple C# Wrapper for the Pinata API


📈 25.54 Punkte
🔧 Programmierung

🔧 Image Optimizer Powered by Pinata: Secure File Storage Meets Real-Time Customization


📈 24.04 Punkte
🔧 Programmierung

🔧 A decentralized file storage system using PINATA and IPFS


📈 24.04 Punkte
🔧 Programmierung

🔧 A decentralized file storage system using PINATA and IPFS


📈 24.04 Punkte
🔧 Programmierung

🔧 Meme Maker Powered by Pinata: Secure File Storage Meets Real-Time Customization


📈 24.04 Punkte
🔧 Programmierung

🔧 Real-Time Chat Application with React and Pinata for Effortless Messaging and File Sharing


📈 24.04 Punkte
🔧 Programmierung

🔧 PinFu: A Dual-Purpose Application for Effortless File Uploads to Pinata


📈 24.04 Punkte
🔧 Programmierung

🕵️ Customer Files Upload Addon 1.5/1.6/1.7 on PrestaShop upload.php PHP File privilege escalation


📈 22.52 Punkte
🕵️ Sicherheitslücken

🕵️ TeamPass bis 2.1.27.8 File Upload upload.files.php Parameter erweiterte Rechte


📈 22.52 Punkte
🕵️ Sicherheitslücken

🕵️ CVE-2024-6083 | PHPVibe 11.0.46 Media Upload Page upload-mp3.php file unrestricted upload


📈 22.38 Punkte
🕵️ Sicherheitslücken

🕵️ CVE-2023-1970 | yuan1994 tpAdmin 1.3.12 Upload.php Upload file unrestricted upload


📈 22.38 Punkte
🕵️ Sicherheitslücken

🕵️ CVE-2023-23314 | zdir 3.2.0 SSH File /api/upload unrestricted upload (ID 90)


📈 21.24 Punkte
🕵️ Sicherheitslücken

🕵️ SEMrush: Unrestricted file upload in www.semrush.com > /my_reports/api/v1/upload/image


📈 21.24 Punkte
🕵️ Sicherheitslücken

🕵️ CVE-2022-29464 | WSO2 API Manager File Upload unrestricted upload


📈 21.24 Punkte
🕵️ Sicherheitslücken

🔧 MySQL&PostgreSQL UI client for testing and querying databases with the query+result uploaded to Pinata


📈 20.42 Punkte
🔧 Programmierung

🔧 Creating NFT Artworks with Pinata


📈 20.42 Punkte
🔧 Programmierung

🔧 Pinata Filesystem and PinDrop


📈 20.42 Punkte
🔧 Programmierung

🔧 Creating NFT Artworks with Pinata


📈 20.42 Punkte
🔧 Programmierung

🔧 StashIt: Your Game Assets Storage Hub | Powered by Pinata 🪅 IPFS SDK


📈 20.42 Punkte
🔧 Programmierung

🔧 Genith: Create Images and Videos with AI, Store with Pinata


📈 20.42 Punkte
🔧 Programmierung

matomo