更新时间:2023-11-19 19:45:52
[编辑-根据Burt的评论忽略此内容.它仅适用于Java/Spring]
[Edit - disregard this as per Burt's comment. It would only work in Java/Spring]
您可能必须将request
对象转换为通常的MultipartHttpServletRequest
:
You might have to cast your request
object to the usual MultipartHttpServletRequest
:
MultipartHttpServletRequest mhsr = (MultipartHttpServletRequest) request
MultipartFile file = mhsr.getFile("attachments")
我猜测,由于Spring安全性似乎正在注入其自己的Servlet3SecurityContextHolderAwareRequestWrapper
版本的request
.
As Spring security appears to be injecting its own Servlet3SecurityContextHolderAwareRequestWrapper
version of request
, I'm guessing.