<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ZIP File Maker Tool</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>ZIP File Maker</h1>
<label for="fileInput">Select Files to ZIP:</label>
<input type="file" id="fileInput" multiple>
<button onclick="createZip()">Create ZIP File</button>
<div id="fileList"></div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="script.js"></script>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Arial, sans-serif;
}
body {
background: linear-gradient(to right, #ff6a00, #ee0979);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
text-align: center;
padding: 10px;
}
.container {
background: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.2);
max-width: 400px;
width: 100%;
}
h1 {
margin-bottom: 15px;
color: #333;
}
label {
font-weight: bold;
display: block;
margin: 10px 0;
}
input {
width: 100%;
padding: 10px;
border: 2px solid #ff6a00;
border-radius: 5px;
margin-bottom: 10px;
}
button {
background: #ff6a00;
color: #fff;
border: none;
padding: 10px;
border-radius: 5px;
cursor: pointer;
width: 100%;
transition: 0.3s;
}
button:hover {
background: #e85b00;
}
#fileList {
margin-top: 15px;
font-size: 14px;
color: #444;
}
function createZip() {
let files = document.getElementById("fileInput").files;
if (files.length === 0) {
alert("Please select at least one file!");
return;
}
let zip = new JSZip();
let fileListDiv = document.getElementById("fileList");
fileListDiv.innerHTML = "<strong>Adding Files:</strong><br>";
Array.from(files).forEach(file => {
zip.file(file.name, file);
fileListDiv.innerHTML += `${file.name}<br>`;
});
zip.generateAsync({ type: "blob" }).then(function (content) {
let zipFileName = "my_files.zip";
let link = document.createElement("a");
link.href = URL.createObjectURL(content);
link.download = zipFileName;
link.click();
});
}
