gpt4 book ai didi

php - HTML表单文件上传

转载 作者:可可西里 更新时间:2023-11-01 00:47:17 25 4
gpt4 key购买 nike

<分区>

我在尝试保存从表单上传的文件时遇到困难,我已经检查了 w3schools 网站上的教程,但我一直收到 undefined index 错误:

注意:未定义索引:C:\wamp\www\HW4\confirm.php 中的用户图片

<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>

以及我用来尝试将其保存到名为“图像”的文件夹中的代码:

move_uploaded_file($_FILES["userpic"]["tmp_name"],"images/".$_FILES["userpic"]["name"]);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com