🚀 Need a ready-to-deploy version?
Includes Docker, setup guide, sample responses, and full API structure.
A Flask-based API that handles secure file uploads and performs file type validation. Designed for lightweight virus scanning pipelines — ClamAV integration placeholder included.
- 📤 Upload files via POST
- 🧠 Validate file types (only allow safe MIME types)
- ⛔ Reject dangerous file extensions (e.g.,
.exe
,.bat
) - 🔒 Max upload size: 5MB
- 🧪 Modular Flask structure with endpoints in
routes/
- 🐳 Docker-ready
POST /upload
Request (form-data):
file
: any file (txt, pdf, docx, xlsx, png, jpg)
Responses:
✅ Success:
{
"filename": "report.pdf",
"status": "unknown",
"details": "Virus scan skipped (ClamAV not available)"
}
❌ Errors:
{ "error": "No file part" }
{ "error": "No selected file" }
{ "error": "File type not allowed" }
{ "error": "Forbidden file type" }
{ "error": "Error occurred while processing file." }
pip install -r requirements.txt
- Flask
python app.py
Server runs at:
http://127.0.0.1:5000/
Or with Docker:
docker build -t file-upload-virus-api .
docker run -p 5000:5000 file-upload-virus-api
- ✅ Successful upload
- ⛔ File type rejected
- 🐞 Upload error simulation
See
/screens/
for Postman previews
You can get a ZIP with full code, Dockerfile, and documentation:
- Email: talabov.ali72@gmail.com
- Telegram: @talabovali
Need this in another language/stack (Node.js, Go, etc)?
Custom dev available — just reach out.