尝试上传文件后出现此错误。
注意:未定义的索引:第20行的C:\ xampp \ htdocs \ lamis \ staff \ title.php中的compfile
尝试上传文件后出现此错误。其他详细记录也很好。
if(isset($_POST['submit'])) {
$titleNo = $_POST['titleNo'];
$area = $_POST['area'];
$map = $_POST['map'];
$coord = $_POST['coord'];
$name = $_POST['name'];
$compfile = $_FILES["compfile"]["name"];
$ret = mysqli_query($con, "select titleNo from pic where titleNo='$titleNo'");
$result = mysqli_fetch_array($ret);
if($result > 0) {
$_SESSION['msg'] = "Sorry the Records already exists !!";
} else {
move_uploaded_file($_FILES["compfile"]
["tmp_name"],"compdocs/".$_FILES["compfile"]["name"]);
$sql = mysqli_query($con,"insert into pic(titleNo,area,map,coord,name,cFile) values('$titleNo','$area','$map','$coord','$name','$compfile')");
文件标签
<input type="file" name="compfile" class="form-control" value="">