Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php HTML表单文件上载_Php_Html - Fatal编程技术网

Php HTML表单文件上载

Php HTML表单文件上载,php,html,Php,Html,我在试图保存从表单上传的文件时遇到困难,我检查了w3schools网站上的教程,但我一直收到一个未定义的索引错误: 注意:C:\wamp\www\HW4\confirm.php中未定义的索引:userpic <form action="confirm.php" method="post"> <div> <fieldset> <legend>New User Signup: </legend> <label> <stro

我在试图保存从表单上传的文件时遇到困难,我检查了w3schools网站上的教程,但我一直收到一个未定义的索引错误:

注意:C:\wamp\www\HW4\confirm.php中未定义的索引:userpic

<form action="confirm.php" method="post">
<div>
<fieldset>
<legend>New User Signup: </legend>
<label> <strong>Name:</strong> <input type="text" name="name" size="16" /></label><br/>
<label> <strong>Gender:</strong> <input type="radio" name="gender" value="M"/> Male
<input type="radio" name="gender" value="F" /> Female
</label><br/>
<label> <strong>Age:</strong> <input type="text" name="age" size="6" maxlength="2" />                         </label>    <br/>
<label> <strong>Personality type:</strong> <input type="text" name="personality"     size="6" maxlength="4" />(<a href="http://www.humanmetrics.com/cgi-win/JType2.asp">Don't     know your type?</a>)</label>
<br/>
    <label> <strong>Favorite OS:</strong> <select name="favos">
    <option selected="selected">Windows</option>
    <option>Mac OS X</option>
    <option>Linux</option></select>
</label><br/>
<label> <strong>Seeking age:</strong> 
<input type="text" name="minage" size="6" maxlength="2" placeholder="min" /> to 
<input type="text" name="maxage" size="6" maxlength="2" placeholder="max"/>
</label><br/>
<label><strong>Photo:</strong><input type="file" name="userpic" id="userpic" /></label>
<input type="submit" value="Sign Up" />
</fieldset>
</div>
</form>
在表单中使用
enctype=“多部分/表单数据”

<form action="confirm.php" enctype="multipart/form-data" method="post">


您应该真正使用/检查php手册,而不是w3schools:因为OP不知道它丢失了,所以它不是一个真正的副本。
<form action="confirm.php" enctype="multipart/form-data" method="post">