Examples
Prev | Chapter 17. HTTP File Upload component | Next

## Examples

### Complex configuration example

Configuration with a separate repository for metadata to `example.com` pointing to `file_upload` data source, custom upload and download URI, maximum file size set to 10MB, expiration done every 6 hours and grouping of slot folders by user jid.

Complex configuration example.

    upload() {
        logic {
            local-only = false
            max-file-size = 10485760
            upload-uri-format = '{proto}://{serverName}:{port}/upload/{userJid}/{slotId}/{filename}'
            download-uri-format = '{proto}://{serverName}:{port}/upload/{domain}/{slotId}/{filename}'
        }

        expiration {
            period = P6H
        }

        repositoryPool {
            'example.com' () {
                data-source = "file_upload"
            }
        }

        store {
            group-by-user = true
        }
    }

### Example configuration for clustering with HA

Configuration for high availability in a cluster with common storage at `/mnt/shared` and both servers available as `upload.example.com`

Example configuration with HA.

    upload() {
        logic {
            upload-uri-format = '{proto}://upload.example.com:{port}/upload/{userJid}/{slotId}/{filename}'
            download-uri-format = '{proto}://upload.example.com:{port}/upload/{domain}/{slotId}/{filename}'
        }

        store {
            path = '/mnt/shared/upload'
        }
    }

Prev | Up | Next
File upload expiration | Home | Chapter 18. HTTP server