> Markdown version of [Upload](https://vaadin.com/docs/v10/flow/components/tutorial-flow-upload). Section index: [llms.txt](https://vaadin.com/docs/v10/flow/llms.txt)

# Upload

## <a id="overview"></a>Overview

`Upload` component allows uploading single or multiple files with drag and drop support.

## <a id="using-upload"></a>Using Upload

`Upload` component allows to upload multiple files at once. Its method `setMaxFiles` may be used to limit maximum number of files to upload. A `Receiver` instance should be specified to receive uploaded data. Here is the simplest case when you want to allow to upload only one file:

```java
FileBuffer fileBuffer = new FileBuffer();
Upload upload = new Upload(fileBuffer);
```

The uploaded data will be stored for you in a file on the filesytem and you may get the data from the file using the `getInputStream()` method.

If you want to allow upload multiple files then you should use a `MultiFileReceiver`. Here is an example:

```java
MultiFileBuffer multiFileBuffer = new MultiFileBuffer();
Upload upload = new Upload(multiFileBuffer);
```

Here the `MultiFileBuffer` class is a ready-made implementation of `MultiFileReceiver`. Similary to the single file case the data will be stored in files on the filesystem and you may get the date using a file name and the `getInputStream(String)` method.

## <a id="using-upload-with-spring"></a>Using Upload with Spring

If you are using Spring then you should provide a `org.springframework.web.multipart.MultipartResolver` bean in your configuration. Otherwise there will be an exception about multi-part configuration absence.

The simplest way to provide a multipart resolver is using `CommonsMultipartResolver` for Apache Commons FileUpload. Add the following code into your configuration class:

```java
@Bean(name = "multipartResolver")
public CommonsMultipartResolver multipartResolver() {
    return new CommonsMultipartResolver();
}
```
