- All Superinterfaces:
AutoCloseable
,Closeable
File upload class, file upload are available when request body is encoded as
MediaType.MULTIPART_FORMDATA
. Example:
{
post("/submit", ctx -> {
FileUpload file = ctx.file("myfile");
});
}
- Since:
- 2.0.0
- Author:
- edgar
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]
bytes()
Content as byte array.void
close()
Free resources, delete temporary file.Content type of file upload.Name of file upload.long
File size or-1
when unknown.getName()
File key.path()
File system path to access file content.stream()
Content as input stream.
-
Method Details
-
getName
File key. That's the field form name, not the file name. Example:- Returns:
- File key. That's the field form name, not the file name.
-
getFileName
Name of file upload.- Returns:
- Name of file upload.
-
getContentType
Content type of file upload.- Returns:
- Content type of file upload.
-
stream
Content as input stream.- Returns:
- Content as input stream.
-
bytes
@NonNull byte[] bytes()Content as byte array.- Returns:
- Content as byte array.
-
path
File system path to access file content.- Returns:
- File system path to access file content.
-
getFileSize
long getFileSize()File size or-1
when unknown.- Returns:
- File size or
-1
when unknown.
-
close
void close()Free resources, delete temporary file.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-