ria/app/Views/download_multiple_files.php
2025-01-02 10:48:47 +05:30

36 lines
1.0 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Download Files</title>
<script>
window.onload = function () {
const fileUrls = <?= json_encode($fileUrls); ?>;
// Function to trigger file downloads
function downloadFiles(urls) {
urls.forEach((url) => {
const link = document.createElement('a');
link.href = file.url;
link.download = file.name; // Use explicit filename
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
});
document.body.removeChild(link);
}
// Start downloading files
downloadFiles(fileUrls);
};
</script>
</head>
<body>
<h1>Your download is starting...</h1>
</body>
</html>