|
| 1 | +# simple-file-upload |
| 2 | + |
| 3 | +Docker container that provides an API endpoint for simple, secure file uploads. |
| 4 | + |
| 5 | +This docker container exposes a single, write-only endpoint at `/upload` that |
| 6 | +accepts a single file along with a `token` GET parameter for authentication. The |
| 7 | +authentication for the endpoint, along with the location of the uploaded file, |
| 8 | +is configured using environment variables on the container. |
| 9 | + |
| 10 | +You can upload a file with curl like so: |
| 11 | + |
| 12 | +```bash |
| 13 | +> curl -XPOST -F 'data=@testuser-file.txt' dockerhost:3000/upload?key=TESTUSER |
| 14 | +``` |
| 15 | + |
| 16 | +Multiple keys are supported, and every key is a 1:1 mapping to a location on |
| 17 | +disk. Any additional uploads for a key will override the previous upload for |
| 18 | +that key. |
| 19 | + |
| 20 | +The design goals for this container are a secure upload tool that: |
| 21 | +1. Can only be used to upload files, not download or read them |
| 22 | +2. Can only be used with a matching authentication key |
| 23 | +3. Can only upload to a single location per authentication key |
| 24 | +4. Can only override the previous upload, not store additional uploads |
| 25 | + |
| 26 | +# How to Use |
| 27 | + |
| 28 | +Basic usage is as follows: |
| 29 | + |
| 30 | +``` |
| 31 | +docker run \ |
| 32 | + -e "KEY_TESTUSER=/uploads/testuser-file.txt" \ |
| 33 | + -v /my_local_dir/:/uploads/ \ |
| 34 | + -p 3000:3000 \ |
| 35 | + twostoryrobot/simple-file-upload |
| 36 | +``` |
| 37 | + |
| 38 | +This will start the upload server, listening on port 3000. Files that are |
| 39 | +uploaded with the key `TESTUSER` will be placed at `/uploads/testuser-file.txt`. |
| 40 | +You can use a volume to get easy access to this file on your host machine, or in |
| 41 | +another container. |
0 commit comments