A secure, temporary file sharing system with customizable expiry times and download limits.
- 🚀 Simple, modern web interface for file uploads
- 🖱️ Drag-and-drop file upload support
- ⏱️ Customizable file expiry (1 hour to 30 days)
- 🔢 Maximum download limits
- 🔗 Short URLs for easy sharing
- 💻 Curl/API support for command-line uploads
- 🔐 Admin interface for file management
- 🗑️ Secure file deletion with delete keys
- 📊 File statistics and tracking
- 🛡️ Rate limiting to prevent abuse
- Python 3.8 or higher
- pip (Python package manager)
- Git (optional, for cloning the repository)
git clone https://github.com/yourusername/kazlabs-file-share.git
cd kazlabs-file-share
#On Windows
python -m venv venv
venv\Scripts\activate
#On Linux
python3 -m venv venv
source venv/bin/activate
#On MacOS
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
This is an example of the config.json file:
{
"UPLOAD_FOLDER": "data",
"META_FOLDER": "meta",
"EXPORT_FOLDER": "Export",
"MAX_CONTENT_LENGTH": 16777216,
"MAX_FILE_SIZE_MB": 16,
"ALLOWED_EXTENSIONS": ["txt", "pdf", "png", "jpg", "jpeg", "gif", "zip", "rar", "7z", "doc", "docx", "xls", "xlsx", "ppt", "pptx"],
"SECRET_KEY": "your-secret-key-here",
"ADMIN_PASSWORD": "change-this-password",
"DEBUG": false,
"MAX_DOWNLOADS": 100,
"WEB_PORT": 5000,
"WEB_HOST": "0.0.0.0",
"WEB_URL": "https://example.com"
}
python app.py
Open your browser and navigate to:
http://localhost:8000
curl -F "file=@/path/to/file" http://localhost:8000/upload/curl
curl -F "file=@/path/to/file" -F "expiry=24h" http://localhost:8000/upload/curl
curl -F "file=@/path/to/file" -F "max_downloads=5" http://localhost:8000/upload/curl
curl -F "file=@/path/to/file" -F "expiry=7d" -F "max_downloads=100" http://localhost:8000/upload/curl
Navigate to the admin interface at:
http://localhost:8000/admin
The response format is JSON. For example:
{
"success": true,
"urls": {
"full": "http://localhost:8000/f/uniqueid/filename",
"short": "http://localhost:8000/s/shortlink",
"delete": "http://localhost:8000/d/uniqueid/deletekey"
},
"expiry": "24h",
"max_downloads": 10,
"file": {
"name": "example.txt",
"size": 1024,
"content_type": "text/plain"
}
}
Method | Route | Description |
---|---|---|
GET | / |
Upload page |
POST | /upload |
Upload files via web interface |
POST | /upload/curl |
Upload files via API |
GET | /f/<unique_id>/<filename> |
Download file |
GET | /s/<short_link> |
Short link redirect |
GET | /d/<unique_id>/<delete_key> |
Delete file with key |
GET | /admin |
Admin interface (password protected) |
GET | /admin/login |
Admin login page |
GET | /admin/logout |
Admin logout |
GET | /admin/files |
List all files (admin only) |
DELETE | /admin/delete/<unique_id>/<filename> |
Delete file (admin only) |
file-share/
├── app.py # Main application entry point
├── config.json # Configuration file
├── logger.py # Custom logging module
├── requirements.txt # Python dependencies
├── README.md # This file
├── changelog.txt # Change history
├── lib/ # Library modules
│ ├── init.py
│ ├── api_handler.py # API response handling
│ ├── auth_manager.py # Authentication management
│ ├── file_handler.py # File operations
│ ├── link_generator.py # URL generation
│ ├── metadata_manager.py # File metadata management
│ └── route_handler.py # Flask route definitions
├── static/ # Static assets
│ ├── script.js # JavaScript for UI
│ └── style.css # CSS styles
└── templates/ # HTML templates
├── admin.html # Admin interface
├── base.html # Base template
├── delete_success.html # Deletion confirmation
├── error.html # Error page
├── login.html # Admin login
├── retrieve.html # File retrieval
├── upload.html # File upload
└── upload_success.html # Upload confirmation
Edit the config.json
file and update the ADMIN_PASSWORD
value.
Edit the config.json
file and update the MAX_CONTENT_LENGTH
value (in bytes) and MAX_FILE_SIZE_MB
value (for display).
Edit the config.json
file and update the ALLOWED_EXTENSIONS
array.
Edit the files in the static/
and templates/
directories to customize the look and feel of the application.
Logs are stored in the location specified by LOG_LOCATION
in your config.json file. The default is logs/file-share.log
in the application directory.
The log format is:
[DateTime] [Component] [LogLevel] Message
- Change the default admin password in
config.json
- Use HTTPS in production environments
- Regularly clean up expired files
- Monitor logs for suspicious activity
- Consider implementing additional authentication for sensitive deployments
- Install Gunicorn:
pip install gunicorn
- Run with Gunicorn:
gunicorn -w 4 -b 0.0.0.0:8000 app:app
- Install Waitress:
python -m pip install waitress
- Run with Waitress:
waitress-serve --port=8000 app:app
- Check the file size limit in
config.json
- Ensure the upload directories are writable
- Check the logs for specific error messages
- Verify the correct password in
config.json
- Check for session issues (try clearing browser cookies)
- Ensure the correct curl syntax is being used
- Check for rate limiting issues
- Verify the file exists and is readable
Contributions are welcome! Please feel free to submit a Pull Request.
© 2025 Kazlabs - Made with