PUT上传不填$_FILES
PUT upload does not fill $_FILES
我正在使用 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
我正在使用 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