PUT上传未填充$ _FILES [英] PUT upload does not fill $_FILES
问题描述
我正在使用PUT方法在前端使用dropzone.js上传文件。但是,当我想使用文件时,Symfony的 Request
对象和 $ _ FILES
数组都为空。
I'm using PUT method to upload files using dropzone.js on frontend. However when I want to work with files both Symfony's Request
object and $_FILES
array are empty.
我已经检查了这个庞大的清单中的所有内容,但对我没有帮助
I have checked everything in this huge checklist and it did not help to me since it does not says anything about uploading via PUT method.
推荐答案
PHP不会转换通过 PUT上传的文件
放入 $ _ FILES
方法,因此Symfony的 Request
对象也为空。
PHP does not convert files uploaded via PUT
method into $_FILES
hence Symfony`s Request
object is empty too.
您需要使用以下代码处理传入文件。
You need to handle incoming file using following code.
/* PUT data comes in on the stdin stream */
$putdata = fopen("php://input", "r");
或使用 $ request-> getContent()$ c $
Or using $request->getContent()
in symfony.
PHP还支持Netscape Composer
和W3C的Amaya客户端使用的PUT方法文件上传。有关更多详细信息,请参见 PUT方法支持。
http://php.net/manual/ zh_cn / features.file-upload.post-method.php
这篇关于PUT上传未填充$ _FILES的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!