How do I convert an uploaded file from apache's UploadedFile
class to a java.io.File
class?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
This code will return your uploaded file in txt file.
The easiest way is to use apache commons FileUtils .
Looking at the documentation (
UploadedFile
andFile
) for both classes, here's one solution.Since you can access the
InputStream
of theUploadedFile
, you can read in the data of the uploaded file and write it to a temporary location or another location that your application can manage.