Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的表单中添加了一个文件类型输入,命名为“图像”,该表单具有 POST 代码链接,这是相关部分:
$file=$_FILES['image']; $name=$file['name'];
我得到的问题是:
未定义索引:C:\wamp\www\agence\ajoutoffre.php 中的图像
我检查了输入的名称一千次,它是正确的。
设置enctype="multipart/form-data"和method="POST"作为<form>元素的属性。默认值分别是enctype="application/x-www-form-urlencoded"和method="GET",不适合文件上传。
enctype="multipart/form-data"
method="POST"
<form>
enctype="application/x-www-form-urlencoded"
method="GET"