Spaces:
Sleeping
Sleeping
File size: 7,912 Bytes
342c773 |
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>File Uploader</title>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
/>
<link
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.10.5/font/bootstrap-icons.min.css"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
/>
<style>
body {
background-color: #121212;
font-family: "Poppins", sans-serif;
color: #e0e0e0;
margin: 0;
padding: 0;
}
h1 {
color: #ffffff;
text-align: center;
margin: 50px 0 20px;
animation: fadeIn 1s ease;
}
.container {
max-width: 600px;
margin: 0 auto;
}
.file-upload-section {
background-color: #1e1e1e;
padding: 30px;
border-radius: 15px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
text-align: center;
position: relative;
animation: fadeInUp 1.5s ease;
}
.file-upload-section input[type="file"] {
background-color: #2c2c2c;
border: 1px solid #444;
color: #e0e0e0;
border-radius: 5px;
width: 100%;
margin-bottom: 20px;
/* padding: 10px; */
transition: background-color 0.3s ease;
}
.file-upload-section input[type="file"]:hover,
.file-upload-section input[type="file"]:focus {
background-color: #3a3a3a;
outline: none;
}
.file-upload-section button {
background-color: #4caf50;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.3s ease;
display: flex;
align-items: center;
gap: 8px;
border: 1px solid #4caf50;
}
.file-upload-section button:hover,
.file-upload-section button:focus {
background-color: transparent;
border: 1px solid #4caf50;
}
.file-actions {
margin-top: 20px;
display: flex;
justify-content: space-around;
}
.alert {
text-align: center;
}
.instructions {
margin-top: 10px;
font-size: 14px;
color: #b0b0b0;
text-align: left;
}
.instructions strong {
color: #ffffff;
}
@media (max-width: 768px) {
.container {
padding: 20px;
}
}
.guide {
background-color: #1e1e1e;
padding: 20px;
border-radius: 10px;
margin-top: 20px;
}
.guide-button {
position: fixed;
top: 20px; /* Adjust the top margin as per your need */
right: 20px; /* Adjust the right margin as per your need */
z-index: 1000; /* Ensure the button is always on top */
}
.guide-button a {
font-size: 16px;
color: #17a2b8;
padding: 5px 10px;
border-radius: 5px;
text-decoration: none;
}
.guide-button a:hover {
background-color: #138496b9; /* Darken on hover */
}
.fas.fa-info-circle {
margin-right: 5px;
}
</style>
</head>
<body>
<!-- Guide Button -->
<div class="guide-button">
<a href="{{ url_for('guide') }}" class="btn">
<i class="fas fa-info-circle"></i> Guide
</a>
</div>
<div class="container">
<h1>Upload Your Resume</h1>
<p class="text-center text-secondary">
Welcome! Please select a Resume to upload.
</p>
<div class="progress">
<div
class="progress-bar"
role="progressbar"
style="width: 10%"
aria-valuenow="10"
aria-valuemin="0"
aria-valuemax="100"
>
Step 1 of 5
</div>
</div>
<div class="file-upload-section">
<form
action="{{ url_for('upload_file') }}"
method="POST"
enctype="multipart/form-data"
id="file-upload-form"
>
<input
type="file"
name="file"
class="form-control"
id="file-input"
required
/>
<button type="submit" class="btn btn-custom">
<i class="bi bi-cloud-upload"></i> Upload & Extract Text
</button>
<div class="instructions mt-3">
<p>
<strong>Supported Formats:</strong> PDF, DOCX, RSF, ODT, PNG, JPG,
JPEG
</p>
<p><strong>File Size Limit:</strong> 5MB</p>
<p>
Please ensure the file is correctly formatted before uploading.
</p>
</div>
</form>
{% if session.get('uploaded_file') %}
<p class="mt-4">
Uploaded:
<span class="text-danger">{{ session.get('uploaded_file') }}</span>
</p>
<div class="file-actions">
<form action="{{ url_for('remove_file') }}" method="post">
<button type="submit" class="btn btn-outline-danger">
<i class="bi bi-trash"></i> Remove Uploaded File
</button>
</form>
</div>
{% endif %}
</div>
{% with messages = get_flashed_messages() %} {% if messages %}
<div class="alert alert-success mt-4" id="flash-message">
{{ messages[0] }}
</div>
{% endif %} {% endwith %}
<div class="guide">
<h5>Instructions:</h5>
<ol class="">
<li>Select a file from your device.</li>
<li>Click the "Upload & Extract Text" button.</li>
<li>
Once uploaded, you can view the extracted text and download it.
</li>
<li>
If needed, remove the uploaded file using the "Remove Uploaded File"
button.
</li>
</ol>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
document.querySelector("form").addEventListener("submit", function (e) {
const fileInput = document.querySelector("#file-input");
const file = fileInput.files[0];
const allowedTypes = [
"application/pdf",
"application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"image/png",
"image/jpeg",
"application/json",
"application/vnd.oasis.opendocument.text",
"text/plain",
];
const maxSize = 5 * 1024 * 1024; // 5MB size limit
if (!allowedTypes.includes(file.type)) {
e.preventDefault();
alert(
"Only PDF, DOCX, RSF, ODT, PNG, JPG, JPEG, and JSON files are allowed."
);
} else if (file.size > maxSize) {
e.preventDefault();
alert("File size must be less than 5MB.");
}
});
// Close flash messages after a timeout
setTimeout(function () {
let flashMessage = document.getElementById("flash-message");
if (flashMessage) {
flashMessage.style.transition = "opacity 1s ease";
flashMessage.style.opacity = 0;
setTimeout(() => flashMessage.remove(), 1000);
}
}, 3000);
</script>
</body>
</html>
|