Package org.springframework.http.codec.multipart

# Interface FilePartEvent

All Superinterfaces:
  `PartEvent`

public interface FilePartEvent extends PartEvent
Represents an event triggered for a file upload. Contains the filename, besides the headers and content exposed through `PartEvent`.

On the client side, instances of this interface can be created via one of the overloaded create methods.

On the server side, multipart file uploads trigger one or more `FilePartEvent`, as described here.

Since:
  6.0
Author:
  Arjen Poutsma
See Also:
  - `PartEvent`

## Method Summary

Modifier and Type
Method
Description
`static reactor.core.publisher.Flux<FilePartEvent>`
`create(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> contents)`
Creates a stream of `FilePartEvent` objects based on the given name, filename(), content-type, and contents.
`static reactor.core.publisher.Flux<FilePartEvent>`
`create(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> contents, Consumer<HttpHeaders> headersConsumer)`
Creates a stream of `FilePartEvent` objects based on the given name, filename(), content-type, and contents.
`static reactor.core.publisher.Flux<FilePartEvent>`
`create(String name, Path path)`
Creates a stream of `FilePartEvent` objects based on the given name and file path.
`static reactor.core.publisher.Flux<FilePartEvent>`
`create(String name, Path path, Consumer<HttpHeaders> headersConsumer)`
Creates a stream of `FilePartEvent` objects based on the given name and file path.
`static reactor.core.publisher.Flux<FilePartEvent>`
`create(String name, org.springframework.core.io.Resource resource)`
Creates a stream of `FilePartEvent` objects based on the given name and resource.
`static reactor.core.publisher.Flux<FilePartEvent>`
`create(String name, org.springframework.core.io.Resource resource, Consumer<HttpHeaders> headersConsumer)`
Creates a stream of `FilePartEvent` objects based on the given name and resource.
`default String`
`filename()`
Return the original filename in the client's filesystem.

### Methods inherited from interface org.springframework.http.codec.multipart.PartEvent

`content, headers, isLast, name`

## Method Details

### filename

default String filename()
Return the original filename in the client's filesystem.

Note: Please keep in mind this filename is supplied by the client and should not be used blindly. In addition to not using the directory portion, the file name could also contain characters such as ".." and others that can be used maliciously. It is recommended to not use this filename directly. Preferably generate a unique one and save this one somewhere for reference, if necessary.

Returns:
  the original filename, or the empty String if no file has been chosen in the multipart form, or `null` if not defined or not available
See Also:
  - RFC 7578, Section 4.2
  - Unrestricted File Upload

### create

static reactor.core.publisher.Flux<FilePartEvent> create(String name, org.springframework.core.io.Resource resource)
Creates a stream of `FilePartEvent` objects based on the given name and resource.

Parameters:
  `name` - the name of the part
  `resource` - the resource
Returns:
  a stream of events

### create

static reactor.core.publisher.Flux<FilePartEvent> create(String name, org.springframework.core.io.Resource resource, @Nullable Consumer<HttpHeaders> headersConsumer)
Creates a stream of `FilePartEvent` objects based on the given name and resource.

Parameters:
  `name` - the name of the part
  `resource` - the resource
  `headersConsumer` - used to change default headers. Can be `null`.
Returns:
  a stream of events

### create

static reactor.core.publisher.Flux<FilePartEvent> create(String name, Path path)
Creates a stream of `FilePartEvent` objects based on the given name and file path.

Parameters:
  `name` - the name of the part
  `path` - the file path
Returns:
  a stream of events

### create

static reactor.core.publisher.Flux<FilePartEvent> create(String name, Path path, @Nullable Consumer<HttpHeaders> headersConsumer)
Creates a stream of `FilePartEvent` objects based on the given name and file path.

Parameters:
  `name` - the name of the part
  `path` - the file path
  `headersConsumer` - used to change default headers. Can be `null`.
Returns:
  a stream of events

### create

static reactor.core.publisher.Flux<FilePartEvent> create(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> contents)
Creates a stream of `FilePartEvent` objects based on the given name, filename(), content-type, and contents.

Parameters:
  `partName` - the name of the part
  `filename` - the filename
  `contentType` - the content-type for the contents
  `contents` - the contents
Returns:
  a stream of events

### create

static reactor.core.publisher.Flux<FilePartEvent> create(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> contents, @Nullable Consumer<HttpHeaders> headersConsumer)
Creates a stream of `FilePartEvent` objects based on the given name, filename(), content-type, and contents.

Parameters:
  `partName` - the name of the part
  `filename` - the filename
  `contentType` - the content-type for the contents
  `contents` - the contents
  `headersConsumer` - used to change default headers. Can be `null`.
Returns:
  a stream of events