Skip to main content

A flexible file upload server with Flask and predefined upload destinations

Project description

flexup

A flexible file upload server with Flask that provides predefined upload destinations.

Similar to uploadserver, but built with Flask and allows you to configure multiple named upload destinations that clients can choose from.

Features

  • File serving with directory browsing
  • Web-based file upload interface
  • Multiple predefined upload destinations
  • Secure filename handling and path traversal prevention
  • HTTP Basic Authentication support
  • File type validation (whitelist/blacklist)
  • Human-readable file sizes in listings
  • Command-line interface

Installation

pip install flexup

Usage

Basic usage (uploads to root directory):

flexup

Specify a custom directory:

flexup -D /path/to/serve

Define multiple upload destinations:

flexup -d images=uploads/images -d docs=uploads/documents -d videos=uploads/videos

Custom port:

flexup --port 8080

With authentication and security:

flexup -D /var/www \
  --basic-auth admin:secret123 \
  --allow-exts txt,pdf,jpg,png \
  --host 127.0.0.1 \
  --port 8080

This will:

  • Serve files from /var/www
  • Require authentication (username: admin, password: secret123)
  • Only allow specific file types
  • Bind to localhost only
  • Run on port 8080

Command-Line Options

-D, --directory    Root directory to serve files from [default: current directory]
-d, --dest         Define upload destination: key=path (can be used multiple times)
--host             Host address to bind to [default: 0.0.0.0 (all interfaces)]
--port             Port to run the server on [default: 5000]
--basic-auth       Enable HTTP Basic Auth: username:password
--allow-exts       Comma-separated list of allowed file extensions (whitelist)
--block-exts       Comma-separated list of blocked file extensions (blacklist)
                   [default blocks: exe,sh,bat,cmd,com,pif,scr,vbs,js,jar,app,deb,rpm]

Security Options

Authentication:

flexup --basic-auth admin:secret123

Bind to localhost only:

flexup --host 127.0.0.1

File type whitelist (most secure):

flexup --allow-exts txt,pdf,jpg,png,gif

File type blacklist (block executables):

flexup --block-exts exe,sh,bat,js

Disable default blocklist (not recommended):

flexup --block-exts ""

Web Interface

Once running, access:

  • http://localhost:5000/ - Browse and download files
  • http://localhost:5000/upload - Upload files to predefined destinations

Uploading with curl

Single File Upload

curl -X POST http://localhost:5000/upload -F "files=@filename.txt"

Multiple Files Upload

Upload multiple files in a single request:

curl -X POST http://localhost:5000/upload \
  -F "files=@file1.txt" \
  -F "files=@file2.txt" \
  -F "files=@file3.txt"

With Authentication

curl -X POST http://localhost:5000/upload \
  -u admin:secret123 \
  -F "files=@document.pdf"

Upload to Specific Destination

If you configured destinations:

flexup -d images=uploads/img -d docs=uploads/documents

Upload to specific destination:

# Single file to images
curl -X POST http://localhost:5000/upload \
  -F "files=@photo.jpg" \
  -F "destination_key=images"

# Multiple files to docs
curl -X POST http://localhost:5000/upload \
  -F "files=@report.pdf" \
  -F "files=@summary.pdf" \
  -F "destination_key=docs"

Bulk Upload

Upload all files in current directory:

curl -X POST http://localhost:5000/upload \
  $(for f in *.txt; do echo "-F files=@$f"; done)

Note: Successful uploads return 204 No Content (matching uploadserver behavior)

Development

Setup

Clone the repository and install development dependencies:

git clone https://github.com/dyay108/flexup.git
cd flexup
pip install -e ".[dev]"

Running Tests

pytest

Code Formatting

black src tests

Type Checking

mypy src

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flexup-0.2.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flexup-0.2.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file flexup-0.2.0.tar.gz.

File metadata

  • Download URL: flexup-0.2.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flexup-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a112806fa9592b2cdbda4592314e2c750574fe10fda8d21b03522e5f2eec6109
MD5 6279ff22c18078d90fa444ada477dcfc
BLAKE2b-256 295a0f852ee75160f87499d77fa9f08e6b69788810c3b1428b2776a9cf772a2b

See more details on using hashes here.

Provenance

The following attestation bundles were made for flexup-0.2.0.tar.gz:

Publisher: publish.yml on dyay108/flexupy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file flexup-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: flexup-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for flexup-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cec2180c00bffdad8b8594f9d1348f93cb32f1dea3c6fca121f8466cf96517b
MD5 bb135989ed36c5fef7c35f44a5ce16d3
BLAKE2b-256 96c1de3b2ce0def0384bf76372196c0f240db590d058ab82d78cf68665bc7505

See more details on using hashes here.

Provenance

The following attestation bundles were made for flexup-0.2.0-py3-none-any.whl:

Publisher: publish.yml on dyay108/flexupy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page