PUT upload does not fill $_FILES

2019-03-05 03:59发布

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.

1条回答
forever°为你锁心
2楼-- · 2019-03-05 04:34

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");

Or using $request->getContent() in symfony.

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

查看更多
登录 后发表回答