gpt4 book ai didi

php - PUT上传未填充$_FILES

转载 作者:行者123 更新时间:2023-12-02 20:54:30 28 4
gpt4 key购买 nike

我正在使用 PUT 方法在前端使用 dropzone.js 上传文件。然而,当我想处理文件时,Symfony 的 Request 对象和 $_FILES 数组都是空的。

我已经检查了 this huge checklist 中的所有内容它对我没有帮助,因为它没有说明任何有关通过 PUT 方法上传的信息。

最佳答案

PHP 不会将通过 PUT 方法上传的文件转换为 $_FILES,因此 Symfony 的 Request 对象也是空的。

您需要使用以下代码处理传入文件。

/* PUT data comes in on the stdin stream */
$putdata = fopen("php://input", "r");

或者在 symfony 中使用 $request->getContent()

PHP also supports PUT-method file uploads as used by Netscape Composer and W3C's Amaya clients. See the PUT Method Support for more details. http://php.net/manual/en/features.file-upload.post-method.php

关于php - PUT上传未填充$_FILES,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40890549/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com