From 4e7321943101b086ecd027fdeff19c428930cbde Mon Sep 17 00:00:00 2001 From: Luv Patel Date: Mon, 18 Sep 2023 00:49:44 +0530 Subject: [PATCH] Revert "added fileinput() function" This reverts commit 28cc5c1423a589e720f445fff1806428beca3f8b. --- docs/js/Vault_search.js | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/docs/js/Vault_search.js b/docs/js/Vault_search.js index 2359269..8ffca38 100644 --- a/docs/js/Vault_search.js +++ b/docs/js/Vault_search.js @@ -1,11 +1,3 @@ -// const express = require("express"); -// const fs = require("fs"); -// const path = require("path"); -// const app = express(); -// const { addListener } = require("process"); -// port =3000; - -// app.use('/static', express.static('static')) // For serving static files const firebaseConfig = { apiKey: "AIzaSyBQBetMo7sP6DV_YvANseKDPb7qSIRCChQ", @@ -170,36 +162,3 @@ var plainphone,defphone; }); } -async function uploadFile() { - const apiKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWQ6ZXRocjoweDQxNjdDNzNjNzk2OTkxRDVlRWVDQ2ViOThhOUFEMThEYmQ4MGQwNzIiLCJpc3MiOiJ3ZWIzLXN0b3JhZ2UiLCJpYXQiOjE2OTQ5NDA1MTMxNDEsIm5hbWUiOiJFbGVjdHJvdmF1bHQifQ.0gge0hCQfm2KmN40LjubYxu35H56CT5zSpOFtuXNIOc"; - const file = fileInput.files[0]; - - if (!file) { - alert('Please select a file to upload.'); - return; - } - - const formData = new FormData(); - formData.append('file', file); - - try { - const response = await fetch('https://api.web3.storage', { - method: 'POST', - headers: { - Authorization: `Bearer ${apiKey}`, - }, - body: formData, - }); - - if (response.ok) { - const { cid } = await response.json(); - alert(`File uploaded successfully! CID: ${cid}`); - } else { - alert('File upload failed. Please check your API key and try again.'); - } - } catch (error) { - console.error('Error:', error); - alert('An error occurred while uploading the file.'); - } -} -