ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
## 上传文件 The file uploads in`$_FILES`are available from the Request object’s`getUploadedFiles()`method. This returns an array keyed by the name of the`input`element. > `$_FILES`中的文件上传可以从请求对象的`getUploadedFiles()`方法获得。这将返回一个以`input`元素的名称作为键值的数组。 ~~~php $files = $request->getUploadedFiles(); ~~~ Figure 11: Get uploaded files Each object in the`$files`array is a instance of`Psr\Http\Message\UploadedFileInterface`and supports the following methods: > $files数组中的每个对象都是`Psr\Http\Message\UploadedFileInterface`的实例,并且支持以下方法: * getStream() * moveTo($targetPath) * getSize() * getError() * getClientFilename() * getClientMediaType() See the[# 使用POST表单上传文件]([https://www.kancloud.cn/dehuadong/slim4/1332006](https://www.kancloud.cn/dehuadong/slim4/1332006))on how to upload files using a POST form.