私はPHPを初めて使用し、このコードを本からコピーしました。ファイルupload.html:
<form method="POST" action="do_upload.php" enctype="multipart/form-data">
<input type="file" name="img1" size="30"></p>
PHPスクリプトdo_upload.php:
if($_FILES["img1"] != "") {
echo "file selected"; else die("Couldnot copy the file");
}
しかし、私は次のようなエラーが発生しました。
未定義のインデックス:2行目のC:\ xampp \ htdocs \ test23\do_upload.phpのimg1
undefined index
upload.htmlにあるのにimg1と呼ばれるのはなぜname="img1"
ですか?