php - 错误 缺少文件部分 PHP Google 云平台 POST
问题描述
我只是试图将订阅表单中的文本“发布”到一个简单的电子邮件 php 文件,但谷歌云给出了这个错误:
<Error>
<Code>InvalidArgument</Code>
<Message>Invalid argument.</Message>
<Details>Missing file part</Details>
</Error>
我尝试了一些方法,包括直接写入 Google Cloud 中的存储桶,但我宁愿将文本通过电子邮件发送到某个地址。为什么缺少文件部分?
这是我的表单代码:
<form action="email.php" method="post" enctype="multipart/form-data">
<input type="text" name="email" size="15" style="font-size:29px;" id="email" required placeholder="Email">
<input value="RSVP" class="button" name="button" style="font-size:29px;" type="submit">
</form>
这是我的 php 文件:
<?php
$to = "email@gmail.com"; //
$from = "no-reply@website.com"; //
$headers = "From: " . $from . "rn";
$subject = "New subscription";
$body = "New user subscription: " . $_POST['email'];
if( filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) )
{
if (mail($to, $subject, $body, $headers, "-f " . $from))
{
echo 'Your e-mail (' . $_POST['echo $this->mail'] . ') has been added to our mailing list!';
}
else
{
echo 'There was a problem with your e-mail (' . $_POST['email'] . ')';
}
}
?>
解决方案
推荐阅读
- javascript - 等待 javascript .find() 结果的最佳实践?
- lua - 如何处理 Wireshark lua 脚本中的字节,例如 180104000118192021222323 格式到 --> 消息 18010400 0118192021222323
- vue-router - Vue3:通过 toRefs 访问 props 收到错误消息
- javascript - 无法在选择标签中选择选项
- javascript - Javascript绑定额外参数
- reactjs - 正确输入 prop injection
- javascript - Nodejs在Docker中运行时无法读取属性
- jmeter - 在 RHEL 上使用参数在命令行中执行 JMeter 测试
- laravel - laravel 8 护照数据类型不匹配
- python - “数据必须在 CBC 模式下填充到 %d 字节边界”%ValueError:数据必须在 CBC 模式下填充到 16 字节边界