# File Upload Application (Deno) A basic file uploading website demonstration, built with Deno and Oak. ## Features (Phase 1) ✓ - **Dual Upload Modes**: - Simple upload page (no JavaScript required) - JavaScript version with chunked uploads for large files - **Multiple File Support**: Upload one or multiple files at once - **File Sharing**: After upload, get shareable URLs for downloaded files - **File Browser**: Browse all uploaded files with size and timestamp info - **Error Handling**: Appropriate error reporting and comprehensive logging - **Configurable Limits**: - File size limit (default: 100MB) - defined in `config.ts` - File type restrictions (configurable in `config.ts`) - File expiration (default: 7 days) - **Rate Limiting**: Per IP address (default: 10 uploads per 15 minutes) - **Smart Naming**: Files keep original names unless collision occurs, then epoch seconds are appended - **Auto Cleanup**: Expired files are automatically removed ## Getting Started ### Prerequisites - Deno 2.0+ installed ([https://deno.land](https://deno.land)) ### Running the Server Development mode (with auto-reload): ```bash deno task dev ``` Production mode: ```bash deno task start ``` The server will start at `http://localhost:8000` ## Configuration Edit `config.ts` to customize: - **Port**: Server port (default: 8000) - **Upload Directory**: Where files are stored (default: ./uploads) - **Max File Size**: Maximum file size in bytes (default: 100MB) - **Allowed File Types**: Array of MIME types (default: all types allowed) - **File Expiration**: Time before files are deleted in ms (default: 7 days) - **Rate Limiting**: Window and max uploads per IP - **Chunk Size**: Size of chunks for chunked uploads (default: 1MB) ## API Endpoints - `GET /` - Simple upload page - `GET /chunked` - Chunked upload page - `GET /browse` - Browse all uploaded files - `POST /upload` - Upload files (multipart/form-data) - `POST /upload-chunk` - Upload file chunks - `GET /download/:filename` - Download a file ## Phase 2 (Planned) - https using letsencrypt key defined at a path defined in config. - Database integration to store file metadata - File model and controller - IP address tracking and association with uploads - Page visit tracking by IP - Enhanced analytics and reporting ## Project Structure ``` . ├── main.ts # Main server and routes ├── config.ts # Configuration settings ├── logger.ts # Logging utility ├── rateLimiter.ts # Rate limiting logic ├── fileUtils.ts # File handling utilities ├── views.ts # HTML template rendering ├── deno.json # Deno configuration └── uploads/ # Uploaded files directory (auto-created) ``` ## Security Features - Rate limiting per IP address - File size validation - File type validation - Automatic file expiration - Comprehensive logging of all operations