0
私は以下の作業スクリプトを持っていますが、イメージ1、イメージ2、イメージ3、イメージ4はボックスの隣にあり、それぞれ異なる名前が必要です。これを行う簡単な方法はありますか? ありがとうございます! また、どこに ヘッダー( "場所:thankyou.php")を挿入しますか?
exit(); ため、現時点ではこれを中に入れた後、それだけでthankyou.phpない(document.php)以下のページにまっすぐに指示し、この行の後複数のファイルを追加するPHP
<?php
$max_no_img = 4; // Maximum number of images value to be set here
echo "<form method=post action='' enctype='multipart/form-data'>";
echo "<table border='0' width='400' cellspacing='0' cellpadding='0' align=center>";
for ($i = 1;$i <= $max_no_img;$i++) {
echo "<tr><td>Images $i</td><td>
<input type=file name='images[]' class='bginput'></td></tr>";
}
echo "<tr><td colspan=2 align=center><input type=submit value='Add Image'></td></tr>";
echo "</form> </table>";
while (list($key, $value) = each($_FILES['images']['name'])) {
//echo $key;
//echo "<br>";
//echo $value;
//echo "<br>";
if (!empty($value)) { // this will check if any blank field is entered
$filename = rand(1, 100000) . $value; // filename stores the value
$filename = str_replace(" ", "_", $filename);
$add = "upload/$filename"; // upload directory path is set
copy($_FILES['images']['tmp_name'][$key], $add);
echo $add;
// upload the file to the server
chmod("$add", 0777); // set permission to the file.
}
}
?>
</body>
</html>
あなたはPHPを知っていますか? –
私はnewbyです!勉強しようとしています。 – user1257518