blob: 2a4d449ab2a3bef4bcce9d3150281ac28174cdc3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
const fileInfo = document.querySelector("#fileInfo");
let link = document.getElementById('link')
async function getID() {
const id = document.getElementById('idInput').value;
const apiKey = document.getElementById('keyInput').value;
const baseURL1 = 'http://localhost:8080/get';
const baseURL2 = 'http://localhost:8080/download';
const url = `${baseURL1}/${id}?key=${apiKey}`;
link.href =`${baseURL2}/${id}?key=${apiKey}` ;
try {
let response = await fetch(url);
let data = await response.json();
fileName = data.fileName;
fileSize = data.fileSize;
fileInfo.innerHTML = `<b>File Name:</b> ${fileName}<br><br></b><b>File Size:</> </b>${fileSize}`;
fileInfo.style.display = 'block';
}
catch (error) {
console.error('Error fetching data:', error);
}
}
|