A file upload server built with Hyper and tokio, designed for reliable chunked uploads. Each uploaded file is processed in parts and merged safely on the server.
- Chunked file uploads
- Automatic merge after last chunk
- Clean-up of temporary chunk files
- Concurrent upload support
- Custom error handling with meaningful HTTP responses
- Built with async Rust using
tokioandhyper
Before running the project, navigate to the server/ folder and set up a .env file based on the provided .env.example
cd server
cp .env.example .env
cargo run --releaseBy default, uploads are saved to the uploads/ directory.
Headers:
X-File-Id: Unique identifier for the upload sessionX-File-Name: Name of the file being uploadedX-Chunk-Index: Current chunk index (0-based)X-Total-Chunks: Total number of chunks expected
Body:
Raw binary data for the current chunk.
Response:
200 OK: Chunk accepted400 Bad Request: If any of the headers are missing or are in invalid format500 Internal Server Error: If any IO or server error occurs
cargo testUnit tests are defined in src/server.rs and cover:
- File creation errors
- Chunk merging correctness
- Cleanup behavior
- Large/empty chunk handling
- Duplicate chunk uploads
- Concurrent uploads (different file IDs)
You can customize upload directories and other parameters via environment variables or config files (see .env.example).
- Add file size validation
- Rate limiting or throttling
- Upload session expiration logic
- Authentication middleware