aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: 96e3d18ab48521c43db407b38271ca22453aca4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# uploadserver

A simple HTTP file upload server with no external dependencies.

- Python 3.10+ (including 3.13+)
- Standard library only

## Installation

```bash
uv sync
```

## Usage

```bash
# Start server with default settings (port 8000, form field "file")
uv run uploadserver

# Custom port and form field name
uv run uploadserver -p 9000 -k document

# Raw body mode - save POST body directly to a file
uv run uploadserver --raw -o /tmp/received.bin
```

## Options

| Option | Description |
|--------|-------------|
| `-p, --port PORT` | Port to listen on (default: 8000) |
| `-k, --key NAME` | Form field name for file uploads (default: file) |
| `--raw` | Accept raw request body as file |
| `-o, --output PATH` | Output path for raw mode (required with --raw) |
| `-d, --debug` | Print incoming requests to stderr |

## Examples

Upload via browser:
```
Open http://localhost:8000 and use the form
```

Upload via curl (multipart):
```bash
curl -F "file=@myfile.txt" http://localhost:8000
```

Upload via curl (raw mode):
```bash
curl -X POST --data-binary @myfile.txt http://localhost:8000
```