swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 788 forks source link

psr7文件上传异常 #115

Closed aprchen closed 6 years ago

aprchen commented 6 years ago

Bug report? | yes swoft | beta swoole | 2.1.0 | PHP version 7.1.14 (cli) (built: Feb 2 2018 08:42:59) ( NTS ) mac 环境

Details

用postman 上传文件,几兆的小文件上传都成功了,但是上传120兆的csv,postman无法获得任何响应,直接报错了,程序当中也没有任何异常输出 image

没有异常输出

Provide minimal script to reproduce the issue

/**
     * @RequestMapping(route="/test/upload",method=RequestMethod::POST)
     *
     * @param Request $request
     * @return array
     */
    public function test(Request $request)
    {
        $id = (int)$request->input('bookId');
        if(empty($id)){
            return ["need id"];
        }
        $file = $request->file("book");
        if ($file instanceof UploadedFileInterface) {
            $type = $file->getClientMediaType();
            if($type == "text/csv"){
                try {
                    $file->moveTo('@runtime/uploadfiles/book_'.$id.".csv");
                    $move = "success";
                } catch (\Throwable $e) {
                    var_dump($e);
                    $move = "false";
                }
            }
        }
        return compact('move');
    }
huangzhhui commented 6 years ago

参照 https://wiki.swoole.com/wiki/page/620.html 调整一下看看

aprchen commented 6 years ago

@huangzhhui 在日志中有看到这个,应该是你说的这个原因 image

不过是在这里改吗?改完了并没有生效 image

huangzhhui commented 6 years ago

请参照此 commit 调整对应的参数