php - 通过 VBA 上传文件时收到 405 错误
问题描述
我正在尝试通过 VBA 将文件从 Outlook 上传到我的 REST API。
我越来越
405 不允许
VBA 代码
Sub uploadjustfile()
Set objhttp = CreateObject("MSXML2.ServerXMLHTTP")
URL = "https://test-url.com/api/upload"
objhttp.Open "POST", URL, False
objhttp.setRequestHeader "Content-type", "application/json"
objhttp.setOption 2, 13056
objhttp.Send ("file=@D:/Zip/one.txt")
MsgBox objhttp.responsetext
End Sub
REST API 代码
$_FILES = json_decode(file_get_contents('php://input'),true);
$response = array('status'=>1);
$this->response($response,200);
此 API 代码在 PHP 脚本中工作。使用测试表单,输出符合预期。
我使用 CodeIgniter 作为后端 PHP 框架。
解决方案
推荐阅读
- android - 当语言环境为印地语时,TextInputEditText 不接受电话号码
- ruby-on-rails - 匹配具有最大相似度的 2 个哈希的有效方法
- php - 如何计算每月的“星期日”来计算缺勤员工
- excel - 在由 50 列组成的给定行中,是否有一个可能的单行方程来找出有多少正数直接跟随另一个正数?
- javascript - 多张卡片的翻转动画
- postgresql - 在 Postgresql 中回滚或反转表分析
- jquery - 如何从具有相同名称的多个输入中获取值,其中输入字段是使用 jQuery 动态创建的?
- python - 使用文件中的类和对象获取信息
- python - 如何使用 BeautifulSoup 获取标签属性名称
- cordova - 浏览器中的 ionic 5 相机插件不显示拍照选项