https://github.com/toxe/simple-file-upload-server
A (very) simple HTTP file upload server
https://github.com/toxe/simple-file-upload-server
file http poetry python python3 server upload
Last synced: about 2 months ago
JSON representation
A (very) simple HTTP file upload server
- Host: GitHub
- URL: https://github.com/toxe/simple-file-upload-server
- Owner: Toxe
- License: mit
- Created: 2020-09-08T16:03:38.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-08T16:58:13.000Z (almost 6 years ago)
- Last Synced: 2025-03-22T17:47:08.617Z (about 1 year ago)
- Topics: file, http, poetry, python, python3, server, upload
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# A (very) simple HTTP file upload server
Note: Not meant for production!
## Dependencies
- Python 3
- [Poetry](https://python-poetry.org)
## Setup Virtual Environment and install Dependencies
```
$ poetry install
$ poetry shell
```
## Configuration
### Flask
#### `.flaskenv` for development and debugging
```ini
FLASK_APP=main
FLASK_ENV=development
```
## Run server
```
$ flask run
```
This will create a folder named `upload` in the current directory (or use an already existing one) to save the uploaded files. Change the upload directory either in `.flaskenv` or pass it as an environment variable.
```
$ mkdir /tmp/upload
$ UPLOAD_FOLDER=/tmp/upload flask run
```
## Upload file
```
$ curl -i -F "file=@README.md" http://localhost:5000/upload
```
```http
HTTP/1.0 201 CREATED
Content-Type: text/html; charset=utf-8
Location: http://localhost:5000/download/README.md
Content-Length: 0
Server: Werkzeug/1.0.1 Python/3.8.5
Date: Tue, 08 Sep 2020 16:09:09 GMT
```
## Download file
```
$ curl -O http://localhost:5000/download/README.md
```