繁体   English   中英

PHP文件上传-操作页面上不存在该字段

[英]PHP File Upload - Field doesn't exist on action page

我有一个接受用户输入并要求他们上载文件(图像,但这对这个问题无关紧要)的表单。 当用户按下提交时,文件的字段似乎没有传递到动作脚本。

表单定义如下:

<form name="AddProduct" id="AddProduct" method="post" enctype="multipart/form-data" action="dothing.php">
<tr>
<td >Item UPC</td>
<td><input name="upccode" type="text" id="upccode" size="40" value="" maxlength="255"></td>
</tr>
<tr>
<td>Item Description</td>
<td><input name="proddesc" type="text" id="proddesc" size="40" value="" maxlength="255"></td>
</tr>
<tr>
<td>Item Image</td>
<td><input type="file" name="file" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="submit" value="Add !" class="submit"></form></td>
</tr>

在dothing.php上,如果我执行print_r($_POST); 这就是我得到的

Array ( [upccode] => 159874288 [proddesc] => A fancy widget [submit] => Add ! )

如果我正在查看请求,因为它已经发布:

-----------------------------11192760525264\r\nContent-Disposition: form-data; name="upccode"\r\n\r\n159874288\r\n-----------------------------11192760525264\r\nContent-Disposition: form-data; name="proddesc"\r\n\r\nA fancy widget\r\n-----------------------------11192760525264\r\nContent-Disposition: form-data; name="file"; filename="gif.gif"\r\nContent-Type: image/gif\r\n\r\nGIF87a?à÷

我的file变量在dothing.php页面上的哪里? 它清楚地表明它已通过。

@Andy:该file将不在$_POST集合中,而将在$_FILES

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM