Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
101 lines (101 loc) · 4.18 KB
/
Copy pathindex.php
File metadata and controls
101 lines (101 loc) · 4.18 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Metadata Extractor</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h2 class="mb-4">Video Metadata Extractor</h2>
<div class="card mb-4">
<div class="card-body">
<form id="videoForm" enctype="multipart/form-data">
<div class="mb-3">
<label for="videoFiles" class="form-label">Select video files</label>
<input class="form-control" type="file" id="videoFiles" name="file[]" multiple accept="video/*">
</div>
<button type="submit" class="btn btn-primary">Upload & Extract Metadata</button>
</form>
</div>
</div>
<div id="results" class="d-none">
<h3>Results</h3>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>File Name</th>
<th>MD5</th>
<th>Size</th>
<th>Frame</th>
<th>Frames</th>
<th>FPS</th>
<th>Codec</th>
<th>Duration</th>
<th>Format</th>
<th>Created Date</th>
<th>Modified Date</th>
<th>Screenshot</th>
</tr>
</thead>
<tbody id="resultsBody">
</tbody>
</table>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
document.getElementById('videoForm').addEventListener('submit', function(e) {
e.preventDefault();
const files = document.getElementById('videoFiles').files;
if (!files.length) return;
const results = [];
let processed = 0;
const tbody = document.getElementById('resultsBody');
tbody.innerHTML = '';
document.getElementById('results').classList.add('d-none');
for (let i = 0; i < files.length; i++) {
const formData = new FormData();
formData.append('file', files[i]);
fetch('process.php', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
results.push(data);
processed++;
if (processed === files.length) {
results.forEach(item => {
const row = document.createElement('tr');
row.innerHTML = `
<td>${item.fileName || ''}</td>
<td>${item.md5 || ''}</td>
<td>${item.size || ''}</td>
<td>${item.frame || ''}</td>
<td>${item.numFrames || ''}</td>
<td>${item.fps || ''}</td>
<td>${item.codec || ''}</td>
<td>${item.duration || ''}</td>
<td>${item.format || ''}</td>
<td>${item.createdDate || ''}</td>
<td>${item.modifiedDate || ''}</td>
<td>${item.screenshot ? `<img src='${item.screenshot}' style='width:120px;max-width:100%;' />` : ''}</td>
`;
tbody.appendChild(row);
});
document.getElementById('results').classList.remove('d-none');
}
})
.catch(err => {
processed++;
alert('Error processing file: ' + files[i].name);
});
}
});
</script>
</body>
</html>