无法获取multipart/form-data boundary提交的POST数据

ericliu

问题描述

我用Http请求提交Content-Type: multipart/form-data; boundary=-------------------------7dvisualgetfile这样的数据给webman,然后通过$request->post()获取不到post数据,是空的
请求头信息:
Content-Type: multipart/form-data; boundary=-------------------------7dvisualgetfile

Post数据:
---------------------------7dvisualgetfile
Content-Disposition: form-data; name="HtmlCode"
Content-Type: application/octet-stream

这里是一段html代码,有很长
---------------------------7dvisualgetfile--

程序代码或配置

    public function langCatPut(Request $request)
    {
        $PostData = $request->post('HtmlCode');
        return response(json_encode($PostData));
    }

重现问题的步骤

获取到的post数据是空的

操作系统环境及workerman/webman等具体版本

本地提交HTTP请求到webman的网站,"workerman/webman-framework": "^1.4.3",

465 2 0
2个回答

10bang

$request->file('HtmlCode');

  • Le 2023-06-12

    之前用$request->file() 是获取不到。。不知道这种获取特定的能不能获取到

liziyu

$request->all()呢

  • 暂无评论
🔝