Module io.jooby
Package io.jooby

Interface FileUpload

All Superinterfaces:
AutoCloseable, Closeable

public interface FileUpload extends 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 Details

    • getName

      @NonNull String 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

      @NonNull String getFileName()
      Name of file upload.
      Returns:
      Name of file upload.
    • getContentType

      @Nullable String getContentType()
      Content type of file upload.
      Returns:
      Content type of file upload.
    • stream

      @NonNull InputStream stream()
      Content as input stream.
      Returns:
      Content as input stream.
    • bytes

      @NonNull byte[] bytes()
      Content as byte array.
      Returns:
      Content as byte array.
    • path

      @NonNull Path 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 interface AutoCloseable
      Specified by:
      close in interface Closeable