It's about uploading xlsx
file. Initially im getting xlsx
file as javax.servlet.http.Part
and trying to convert as ByteArrayResource
Since i need to pass via RestTemplate
.
new ByteArrayResource(IOUtils.toByteArray(input.getFile().getInputStream())
Here input.getFile()
is 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
?
Anyhow we can get filename
from Part
, I want to know is that possible to get filename
from ByteArrayResource
or ByteArray
?
You'll probably need to use FileNameAwareByteArrayResource as outlined in this answer
https://stackoverflow.com/questions/42416015/spring-boot-multipartfile-issue-with-bytearrayresource
and you'll be able to get filename from it then.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.