php 上传 - 未定义的索引iis
我的 html 表单看起来像这样:
<form action="dins.php" method="get" name="test" enctype="multipart/form-data">
<table class="formTable" id="programTable">
<tr>
<td class="ft_head">Title</td>
<td><input type="text" size="26px" name="title" id="title" autocomplete="off" /></td>
<td></td>
</tr>
<tr>
<td class="ft_head">Objective</td>
<td><textarea width="26px" height="18px" name="obj" id="obj" autocomplete="off"></textarea></td>
<td></td>
</tr>
<tr>
<td class="ft_head">Theory</td>
<td><textarea width="26px" height="36px" name="theory" id="theory" autocomplete="off"></textarea></td>
<td></td>
</tr>
<tr>
<td class="ft_head">Code</td>
<td><input type="file" width="26px" name="code" id="code" /></textarea></td>
<td></td>
</tr>
<tr>
<td class="ft_head">Output</td>
<td><input type="file" width="26px" name="output" id="output" /></td>
<td></td>
</tr>
<tr>
<td class="ft_head">Conclusion</td>
<td><textarea width="26px" height="36px" name="conc" id="conc" autocomplete="off"></textarea></td>
<td></td>
</tr>
</table>
<input type="submit" value="submit" name="sub" />
<form>
我的部分 php 脚本是这样的:
if(isset($_GET['title']) && isset($_GET['obj']) && isset($_GET['theory']) &&
$_FILES['code']['size']>0 && $_FILES['output']['size']>0 && isset($_GET['conc']))
我收到以下错误:
_Unable to fetch values.PHP Notice: Undefined index: code in
E:\Repository\HTML\123\assign_cg\dins.php on line 4_
我尝试修改 php.ini 的 upload_max_size
但没有帮助。我正在运行 WIMP。
My html form looks something like this:
<form action="dins.php" method="get" name="test" enctype="multipart/form-data">
<table class="formTable" id="programTable">
<tr>
<td class="ft_head">Title</td>
<td><input type="text" size="26px" name="title" id="title" autocomplete="off" /></td>
<td></td>
</tr>
<tr>
<td class="ft_head">Objective</td>
<td><textarea width="26px" height="18px" name="obj" id="obj" autocomplete="off"></textarea></td>
<td></td>
</tr>
<tr>
<td class="ft_head">Theory</td>
<td><textarea width="26px" height="36px" name="theory" id="theory" autocomplete="off"></textarea></td>
<td></td>
</tr>
<tr>
<td class="ft_head">Code</td>
<td><input type="file" width="26px" name="code" id="code" /></textarea></td>
<td></td>
</tr>
<tr>
<td class="ft_head">Output</td>
<td><input type="file" width="26px" name="output" id="output" /></td>
<td></td>
</tr>
<tr>
<td class="ft_head">Conclusion</td>
<td><textarea width="26px" height="36px" name="conc" id="conc" autocomplete="off"></textarea></td>
<td></td>
</tr>
</table>
<input type="submit" value="submit" name="sub" />
<form>
My part php script is this:
if(isset($_GET['title']) && isset($_GET['obj']) && isset($_GET['theory']) &&
$_FILES['code']['size']>0 && $_FILES['output']['size']>0 && isset($_GET['conc']))
I am getting the following error:
_Unable to fetch values.PHP Notice: Undefined index: code in
E:\Repository\HTML\123\assign_cg\dins.php on line 4_
I tried modifying php.ini for upload_max_size
but did not help. I am running WIMP.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将表单方法更改为 POST。
您不能通过
GET
上传文件,这就是POST
的用途。如果确实需要更多说明,
GET
通常用于从服务器检索数据,而POST
用于发送 em> 数据到服务器。You should change your form method to POST.
You cannot upload files via
GET
, that is whatPOST
is for.In case more clarification is really needed,
GET
is generally used for retrieving data from the server, whilePOST
is for sending data to the server.