質問編集履歴
6
x
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,11 +42,19 @@
|
|
42
42
|
|
43
43
|
$ln_path = $ch_dir -> path . "/" .$file_name;
|
44
44
|
|
45
|
+
|
46
|
+
|
45
47
|
if (@getimagesize($ln_path)){
|
46
48
|
|
47
|
-
echo "<a href = \"imgview.php?d=" .urlencode(mb_convert_encoding($ln_path, "UTF-8")). "\" target = \"_blank\" >";
|
48
49
|
|
50
|
+
|
51
|
+
echo "<a href = \"imgview.php?d=" .urlencode(mb_convert_encoding($ln_path, "UTF-8")). "\" target = \"_blank\" >";
|
52
|
+
|
49
|
-
echo "<img src = \"" .$ln_path. "\" width=\"100\"></a> ";
|
53
|
+
echo "<img src = \"" .$ln_path. "\" width=\"100\"></a> ";
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
}}
|
50
58
|
|
51
59
|
$ch_dir -> close();}
|
52
60
|
|
@@ -67,10 +75,6 @@
|
|
67
75
|
$uploadDir = './files/';
|
68
76
|
|
69
77
|
$uploadPath = $uploadDir . $_FILES['userfile']['name'];
|
70
|
-
|
71
|
-
echo "<a href = \"imgview.php?d=" .urlencode(mb_convert_encoding($ln_path, "UTF-8")). "\" target = \"_blank\" >";
|
72
|
-
|
73
|
-
echo "<img src = \"" .$ln_path. "\" width=\"100\"></a> ";
|
74
78
|
|
75
79
|
|
76
80
|
|
@@ -106,6 +110,8 @@
|
|
106
110
|
|
107
111
|
|
108
112
|
|
109
|
-
```
|
113
|
+
```二度送信ボタンを押さなければ選択した画像が表示されません
|
114
|
+
|
115
|
+
|
110
116
|
|
111
117
|
このコードを実行して送信ボタンを押したと同時に選択した画像を一覧に表示するにはどうすればよいのでしょうか
|
5
s
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
+
```php
|
2
|
+
|
1
|
-
|
3
|
+
//index2.php
|
4
|
+
|
5
|
+
|
2
6
|
|
3
7
|
<!DOCTYPE html>
|
4
8
|
|
4
z
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
```php index
|
1
|
+
```php index2.php
|
2
2
|
|
3
3
|
<!DOCTYPE html>
|
4
4
|
|
5
5
|
<html lang ="en">
|
6
6
|
|
7
|
+
|
8
|
+
|
7
9
|
<body>
|
8
10
|
|
9
|
-
<form enctype="multipart/form-data" method="POST" action="index
|
11
|
+
<form enctype="multipart/form-data" method="POST" action="index2.php">
|
10
12
|
|
11
13
|
<input type ="file" name ="userfile">
|
12
14
|
|
@@ -14,15 +16,15 @@
|
|
14
16
|
|
15
17
|
</form>
|
16
18
|
|
17
|
-
|
18
|
-
|
19
19
|
</body>
|
20
20
|
|
21
21
|
|
22
22
|
|
23
23
|
<?php
|
24
24
|
|
25
|
+
|
26
|
+
|
25
|
-
$dir_path =
|
27
|
+
$dir_path = './files/';
|
26
28
|
|
27
29
|
if (is_dir($dir_path)){
|
28
30
|
|
@@ -40,19 +42,9 @@
|
|
40
42
|
|
41
43
|
echo "<a href = \"imgview.php?d=" .urlencode(mb_convert_encoding($ln_path, "UTF-8")). "\" target = \"_blank\" >";
|
42
44
|
|
43
|
-
echo "<img src = \"" .$ln_path. "\" width=\"100\"></a> ";
|
45
|
+
echo "<img src = \"" .$ln_path. "\" width=\"100\"></a> ";}}
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
}
|
48
|
-
|
49
|
-
$ch_dir -> close();
|
47
|
+
$ch_dir -> close();}
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
56
48
|
|
57
49
|
else{
|
58
50
|
|
@@ -60,13 +52,9 @@
|
|
60
52
|
|
61
53
|
else{
|
62
54
|
|
63
|
-
echo 'DIR 画像がないよ';
|
55
|
+
echo 'DIR 画像がないよ';}
|
64
|
-
|
65
|
-
}
|
66
56
|
|
67
57
|
|
68
|
-
|
69
|
-
if(!isset($_POST['submit'])){
|
70
58
|
|
71
59
|
if(isset($_FILES["userfile"]) and $_FILES["userfile"]["error"]==0){
|
72
60
|
|
@@ -76,6 +64,16 @@
|
|
76
64
|
|
77
65
|
$uploadPath = $uploadDir . $_FILES['userfile']['name'];
|
78
66
|
|
67
|
+
echo "<a href = \"imgview.php?d=" .urlencode(mb_convert_encoding($ln_path, "UTF-8")). "\" target = \"_blank\" >";
|
68
|
+
|
69
|
+
echo "<img src = \"" .$ln_path. "\" width=\"100\"></a> ";
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
if(!isset($_POST['submit'])){
|
76
|
+
|
79
77
|
if(move_uploaded_file(
|
80
78
|
|
81
79
|
$_FILES['userfile']['tmp_name'],
|
@@ -84,23 +82,21 @@
|
|
84
82
|
|
85
83
|
)){
|
86
84
|
|
87
|
-
echo "<a href = \"imgview.php?d=" .urlencode(mb_convert_encoding($ln_path, "UTF-8")). "\" target = \"_blank\" >";
|
88
|
-
|
89
|
-
echo "<img src = \"" .$ln_path. "\" width=\"100\"></a> ";
|
90
|
-
|
91
|
-
echo '成功';
|
85
|
+
echo '成功です';
|
92
86
|
|
93
87
|
}else{
|
94
88
|
|
95
|
-
echo '失敗';
|
89
|
+
echo '失敗です';
|
90
|
+
|
91
|
+
}
|
96
92
|
|
97
93
|
|
98
|
-
|
99
|
-
}
|
100
94
|
|
101
95
|
}
|
102
96
|
|
103
97
|
}
|
98
|
+
|
99
|
+
|
104
100
|
|
105
101
|
?>
|
106
102
|
|
3
k
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
<body>
|
8
8
|
|
9
|
-
<form enctype="multipart/form-data" method="POST" action="index1.php>
|
9
|
+
<form enctype="multipart/form-data" method="POST" action="index1.php" >
|
10
10
|
|
11
11
|
<input type ="file" name ="userfile">
|
12
12
|
|
@@ -40,11 +40,19 @@
|
|
40
40
|
|
41
41
|
echo "<a href = \"imgview.php?d=" .urlencode(mb_convert_encoding($ln_path, "UTF-8")). "\" target = \"_blank\" >";
|
42
42
|
|
43
|
-
echo "<img src = \"" .$ln_path. "\" width=\"100\"></a> ";
|
43
|
+
echo "<img src = \"" .$ln_path. "\" width=\"100\"></a> ";
|
44
|
+
|
45
|
+
|
44
46
|
|
45
47
|
}
|
46
48
|
|
47
|
-
$ch_dir -> close();
|
49
|
+
$ch_dir -> close();
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
}
|
48
56
|
|
49
57
|
else{
|
50
58
|
|
@@ -57,6 +65,8 @@
|
|
57
65
|
}
|
58
66
|
|
59
67
|
|
68
|
+
|
69
|
+
if(!isset($_POST['submit'])){
|
60
70
|
|
61
71
|
if(isset($_FILES["userfile"]) and $_FILES["userfile"]["error"]==0){
|
62
72
|
|
@@ -74,6 +84,10 @@
|
|
74
84
|
|
75
85
|
)){
|
76
86
|
|
87
|
+
echo "<a href = \"imgview.php?d=" .urlencode(mb_convert_encoding($ln_path, "UTF-8")). "\" target = \"_blank\" >";
|
88
|
+
|
89
|
+
echo "<img src = \"" .$ln_path. "\" width=\"100\"></a> ";
|
90
|
+
|
77
91
|
echo '成功';
|
78
92
|
|
79
93
|
}else{
|
@@ -86,7 +100,7 @@
|
|
86
100
|
|
87
101
|
}
|
88
102
|
|
89
|
-
|
103
|
+
}
|
90
104
|
|
91
105
|
?>
|
92
106
|
|
2
a
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
```php
|
1
|
+
```php index1.php
|
2
2
|
|
3
3
|
<!DOCTYPE html>
|
4
4
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
<body>
|
8
8
|
|
9
|
-
<form enctype="multipart/form-data" >
|
9
|
+
<form enctype="multipart/form-data" method="POST" action="index1.php>
|
10
10
|
|
11
11
|
<input type ="file" name ="userfile">
|
12
12
|
|
1
あ
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
<body>
|
8
8
|
|
9
|
-
<form enctype="multipart/form-data"
|
9
|
+
<form enctype="multipart/form-data" >
|
10
10
|
|
11
11
|
<input type ="file" name ="userfile">
|
12
12
|
|