Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A secure Flask-based API for uploading files with MIME-type validation and file extension filtering. Built to integrate lightweight virus scanning (ClamAV-ready) into any project.

Notifications You must be signed in to change notification settings

Talabov/File-Upload-Virus-Scan-API

Repository files navigation

πŸ›‘ File Upload & Virus Scan API


πŸš€ Need a ready-to-deploy version?

Includes Docker, setup guide, sample responses, and full API structure.

πŸ‘‰ Buy it on Gumroad


A Flask-based API that handles secure file uploads and performs file type validation. Designed for lightweight virus scanning pipelines β€” ClamAV integration placeholder included.


βœ… Key Features

  • πŸ“€ 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

πŸš€ Endpoint

Upload & Scan File

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." }

βš™οΈ Requirements

pip install -r requirements.txt
  • Flask

πŸ–₯ How to Run

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

πŸ§ͺ Example Screenshots

  • βœ… Successful upload
  • β›” File type rejected
  • 🐞 Upload error simulation

See /screens/ for Postman previews


πŸ’Ό Ready-to-Use Version

You can get a ZIP with full code, Dockerfile, and documentation:

πŸ‘‰ Buy it on Gumroad


πŸ“¬ Contacts


Need this in another language/stack (Node.js, Go, etc)?
Custom dev available β€” just reach out.

About

A secure Flask-based API for uploading files with MIME-type validation and file extension filtering. Built to integrate lightweight virus scanning (ClamAV-ready) into any project.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /