Skip to content

Commit 496a90e

Browse files
authored
Update index.html
1 parent 5213b0a commit 496a90e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

index.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
<!-- code by navnee1h -->
21
<!DOCTYPE html>
32
<html>
43
<head>
5-
<title>Upload Your Files/title>
4+
<title>File Upload with Progress and Speed</title>
65
<style>
76
body {
87
font-family: Arial, sans-serif;
@@ -158,14 +157,15 @@ <h2>Upload Multiple Files</h2>
158157
const percentComplete = (event.loaded / event.total) * 100;
159158
progressBar.value = percentComplete;
160159

161-
const elapsedTime = (Date.now() - startTime) / 1000; // time in seconds
162-
const speed = (event.loaded / elapsedTime) / (1024 * 1024); // speed in MB/s
160+
const elapsedTime = (Date.now() - startTime) / 1000; // Time in seconds
161+
const speed = (event.loaded / elapsedTime) / (1024 * 1024); // Speed in MB/s
163162
status.textContent = `Transferred: ${Math.round(event.loaded / (1024 * 1024))} MB /
164163
${Math.round(event.total / (1024 * 1024))} MB
165164
(${percentComplete.toFixed(2)}%) at ${speed.toFixed(2)} MB/s`;
166165
}
167166
};
168167

168+
// Reset progress bar and display success message upon completion
169169
xhr.onload = function() {
170170
if (xhr.status === 200) {
171171
alert('Files uploaded successfully!');
@@ -190,4 +190,3 @@ <h2>Upload Multiple Files</h2>
190190
</script>
191191
</body>
192192
</html>
193-
<!-- code by navnee1h -->

0 commit comments

Comments
 (0)