-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
30 lines (29 loc) · 1.12 KB
/
index.php
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
<h1>Simple Image Upload Solution</h1>
<form method="POST" action="image.php" enctype="multipart/form-data">
<input type="file" name="my_image" />
<input type="text" name="secret" value="super_secret" style="display:none">
<input type="submit" value="Upload" />
</form>
<p>
<a href="https://github.com/therohitdas/image-storage-php">Download the source code or Dockerfile</a>
</p>
<form method="POST" action="image.php" enctype="multipart/form-data">
<input type="text" placeholder="enter the id to delete image" name="id" />
<input type="submit" value="Delete" />
</form>
<p>
<input id="id" type="text" placeholder="enter the id to display image">
<br>
<button id="show" style="margin-top: 10px;">Show Image</button>
</p>
<script>
var id = document.getElementById("id");
var show = document.getElementById("show");
show.addEventListener("click", function() {
// add an image tag with the image url
var img = document.createElement("img");
img.src = "image.php?id=" + id.value;
img.style.margin = "20px auto";
document.body.appendChild(img);
});
</script>