[英]File uploads not working
I've made a contact form with an option to upload image. 我已经制作了联系表格,其中包含可以上传图片的选项。 It's in WordPress(my form is a part of a custom plugin I'm making).
它在WordPress中(我的表单是我正在制作的自定义插件的一部分)。
Everytime I upload a file, I find $_FILE to be empty. 每次上传文件时,我发现$ _FILE为空。
Here's code of my form. 这是我表格的代码。
<table>
<tr>
<td valign="top">
<form action="" method="post" enctype="multipart/form-data">
<table cellspacing="0" cellpadding="0" bordercolor="#000000" border="0" bgcolor="#ffffff" width="100%">
<tbody>
<tr>
<td width="100%">
<table cellspacing="0" cellpadding="2" border="0" width="100%">
<tbody>
<tr>
<td width="50%" height="35" >Your Name:<span >*</span></td>
<td width="50%"><font size="2" face="Arial" color="#000000">
<input type="text" size="20" value="" id="name" name="formAppName"></font>
</td>
</tr>
<tr>
<td height="35" >Your Web Address:<span >*</span></td>
<td><font size="2" face="Arial" color="#000000">
<input type="text" size="20" value="" id="webAddress" name="webAddress"></font>
</td>
</tr>
<tr>
<td height="35" >E-mail Address:<span >*</span></td>
<td><input type="text" size="20" value="" id="email" name="email"></td>
</tr>
<tr>
<td height="35" >Subject title:<span >*</span></td>
<td><font size="2" face="Arial" color="#000000">
<input type="text" size="30" value="" id="subjectTitle" name="subjectTitle"></font>
</td>
</tr>
<tr>
<td height="35" >Upload Photo:<span >*</span></td>
<td><font size="2" face="Arial" color="#000000">
<input type="file" size="25" id="formAppPhoto" name="formAppPhoto"></font>
</td>
</tr>
<tr>
<td colspan="2">Body Text:<span >*</span></td>
</tr>
<tr>
<td colspan="2">
<textarea rows="25" cols="65" name="bodyText"></textarea>
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr><td colspan="2"><input type="submit" value="Submit" name="Submit"></td></tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<input type="hidden" name="formAppDo" value="45645645" />
<input type="hidden" name="formAppId" value="98" />
</form>
</td>
</tr>
作为参考,它是$ _FILES,而不是$ _FILE。
First of all, action
is missing from your form (it's empty). 首先,表单中缺少
action
(该action
为空)。 Also, you need to post what you have done in your PHP script. 另外,您需要发布您在PHP脚本中所做的事情。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.