[英]can we get filename from byteArrayResource?
It's about uploading xlsx
file. 关于上传
xlsx
文件。 Initially im getting xlsx
file as javax.servlet.http.Part
and trying to convert as ByteArrayResource
Since i need to pass via RestTemplate
. 最初我将
xlsx
文件获取为javax.servlet.http.Part
并尝试转换为ByteArrayResource
因为我需要通过RestTemplate
传递。
new ByteArrayResource(IOUtils.toByteArray(input.getFile().getInputStream())
Here input.getFile()
is javax.servlet.http.Part
这里
input.getFile()
是javax.servlet.http.Part
As im converting here into ByteArrayResource
and sending back to another Layer for business logic, can i get filename
from ByteArrayResource
? 当我在这里将其转换为
ByteArrayResource
并发送回另一层用于业务逻辑时,我可以从ByteArrayResource
获取filename
吗?
Anyhow we can get filename
from Part
, I want to know is that possible to get filename
from ByteArrayResource
or ByteArray
? 无论如何,我们都可以从
Part
获取filename
,我想知道是否可以从ByteArrayResource
或ByteArray
获取filename
?
You'll probably need to use FileNameAwareByteArrayResource as outlined in this answer 您可能需要使用此答案中概述的FileNameAwareByteArrayResource
https://stackoverflow.com/questions/42416015/spring-boot-multipartfile-issue-with-bytearrayresource
and you'll be able to get filename from it then. 然后您就可以从中获取文件名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.