-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.php
More file actions
52 lines (44 loc) · 1.34 KB
/
view.php
File metadata and controls
52 lines (44 loc) · 1.34 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>View Uploaded Files</title>
<style>
.file-item {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.file-name {
margin-right: 10px;
}
</style>
</head>
<body>
<h1>View Uploaded Files</h1>
<div id="file-list">
<?php
$connection = new mysqli("localhost", "root", "", "images");
if ($connection->connect_errno != 0) {
die("Database Connectivity Error");
}
$sql = "SELECT image_url FROM images";
$result = $connection->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$file = $row['image_url'];
$file_path = dirname($_SERVER['PHP_SELF']) . '/' . $file;
echo '<div class="file-item">';
echo '<span class="file-name">' . $file . '</span>';
echo '<a href="' . $file_path . '" target="_blank">View</a>';
echo '</div>';
}
} else {
echo '<p>No files uploaded yet.</p>';
}
?>
</div>
</body>
</html>