= 0) && ($bytes < $kb)) { return $bytes . ' B'; } elseif (($bytes >= $kb) && ($bytes < $mb)) { return ceil($bytes / $kb) . ' KB'; } elseif (($bytes >= $mb) && ($bytes < $gb)) { return ceil($bytes / $mb) . ' MB'; } elseif (($bytes >= $gb) && ($bytes < $tb)) { return ceil($bytes / $gb) . ' GB'; } elseif ($bytes >= $tb) { return ceil($bytes / $tb) . ' TB'; } else { return $bytes . ' B'; } } $maxsize = max_size; // Get uploaded file $file = $_GET['file']; $fileURL = base64_decode($file); $filesize = filesize($fileURL); $baseurl = file_url_destination; // Check if file exists if(!file_exists($fileURL)){ http_response_code(404); } if($file == ''){ http_response_code(404); } $core = new Core(); ?> <?=app_name?> - Download
const downloadBtn = document.querySelector(".download-btn"); const fileLink = "' . $fileURL .'"; const initTimer = () => { if(downloadBtn.classList.contains("disable-timer")) { return window.open(fileLink); } let timer = downloadBtn.dataset.timer; downloadBtn.classList.add("timer"); downloadBtn.innerHTML = `Your download will begin in ${timer} seconds`; const initCounter = setInterval(() => { if(timer > 0) { timer--; return downloadBtn.innerHTML = `Your download will begin in ${timer} seconds`; } clearInterval(initCounter); window.open(fileLink); downloadBtn.innerText = "Your file is downloading..."; setTimeout(() => { downloadBtn.classList.replace("timer", "disable-timer"); downloadBtn.innerHTML = `Download Again`; }, 3000); }, 1000); } downloadBtn.addEventListener("click", initTimer); '; ?>