$ _FILES不起作用,并给出行错误

时间:2020-07-27 19:43:49

标签: php file

我编写了php代码以上传图片 这段代码给出了错误

<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["blogimage"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if(isset($_POST["ok"])) {
  $check = getimagesize($_FILES["blogimage"]["tmp_name"]);
  if($check !== false) {
    echo "File is an image - " . $check["mime"] . ".";
    $uploadOk = 1;
  } else {
    echo "File is not an image.";
    $uploadOk = 0;
  }
}
?>

这是错误。 请帮助我

 Notice: Undefined index: blogimage in C:\MAMP\htdocs\shilalipi\admin\addnew.php on line 62

0 个答案:

没有答案
相关问题