$ _FILES不包含表单文件输入

时间:2018-07-29 08:41:57

标签: php file file-upload

我正在执行一个简单的表单上传,其中包括文件上传

这是html代码:

<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post" enctype="    multipart/form-data">

<div class="form-group col-xs-8">
         <label for="image">image</label>
         <input type="file" class="form-control"  id="image" name="image" required="">
 </div>

<div class="form-group col-xs-8">
       <button type="submit" class="form-control btn btn-success" id="subm" name="submit_e"><span class="glyphicon glyphicon-cloud-upload"></span> ADD</button>
 </div>

PHP代码:

include('dbconnect.php');

if(isset($_POST['submit_e'])){

        $image_name=$_FILES['image']['name'];
        $folder="uploads/";
        move_uploaded_file($_FILES['image']['tmp_name'], $folder.$_FILES['image']['name']);

$query="INSERT INTO products(folder,image_name) VALUES ('$folder','$image_name');
$exec=mysqli_query($conn,$query);

我在浏览器中收到此错误:     注意:未定义索引:第13行的C:\ xampp2 \ htdocs \ ecommerce \ admin \ index.php中的图片

我在那里想念什么?

0 个答案:

没有答案