Skip to content

SparksFlash/Concurrent-File-Transfer-System-with-web-GUI

Repository files navigation

Concurrent File Transfer System with GUI

A lightweight, concurrent file transfer server with a web interface.

This project demonstrates a Python-based concurrent file server (TCP) alongside a Flask web frontend that lists available files and lets users download them through the web UI. The server handles multiple concurrent transfers using worker threads and provides monitoring via the dashboard.

Key features

  • Concurrent file transfers using threads.
  • Simple TCP-based file transfer server for client downloads.
  • Flask-based web interface with:
    • File listing (/api/available-files)
    • HTTP download endpoint (/api/download/<filename>)
    • Dashboard (/dashboard) showing server stats
    • Download page (/download) with streaming download support and progress UI
  • Uploads directory (uploads/) as the source for available files

Project Structure

  • run_server.py – Main entrypoint: sets up Flask app, a background file server, and sample files.
  • config.py – Configuration values such as UPLOAD_FOLDER, ports, and buffer sizes.
  • server/ – Contains the concurrent file server implementation:
    • file_server.py – TCP server that accepts client connections and spawns handlers.
    • file_handler.py – Thread class that streams files to connected TCP clients.
  • templates/ – Jinja2 templates for web pages (index, dashboard, download, base).
  • static/ – CSS and JS used by the frontend.
  • uploads/ – Directory where files to serve/download are stored.

Installation

  1. Create and activate a virtual environment (recommended):
python3 -m venv venv
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt

Running the application

From the project root, run:

python3 run_server.py
  • The Flask web UI will be available at http://localhost:5000 by default.
  • The background file server listens on the TCP port configured in config.py (default 8888).

Notes:

  • The web UI lists files from the uploads/ folder. The app will create uploads/ and some sample files at first run.
  • The download page uses an HTTP streaming fetch request to /api/download/<filename> to provide a browser-friendly download and progress UI.

Usage

  • Open the dashboard: http://localhost:5000/dashboard to view server status and active transfers.
  • Open the download page: http://localhost:5000/download to see available files and download them.
  • API endpoints useful for automation or debugging:
    • GET /api/available-files — returns a JSON list of files available for download.
    • GET /api/download/<filename> — returns the file as an attachment (used by the web UI).
    • GET /api/server-status — returns server runtime stats.

Troubleshooting

  • ModuleNotFoundError: No module named 'flask' — ensure the virtual environment is activated and dependencies are installed (pip install -r requirements.txt).
  • Files not appearing in the UI:
    • Confirm files exist under the uploads/ directory.
    • Confirm config.py sets UPLOAD_FOLDER = 'uploads' (relative path from the project root).
    • Confirm the Flask app is running and reachable at http://localhost:5000.

Development notes

  • The project provides a small ConcurrentFileServer (TCP) for client-style transfers and a Flask app for browser interactions. The two servers run concurrently: the background TCP server on Config.PORT and Flask on Config.WEB_PORT.
  • The frontend was updated to use HTTP streaming for browser downloads (instead of WebSocket), which is compatible with the Flask send_file route.

Contributing

Contributions are welcome. Please open an issue or submit a pull request with a clear description of the change.

License

This project is provided under the MIT License — see LICENSE for details.

Author

  • Project created/maintained by Sandipta Saha (Sourav).

About

Multithreaded TCP file server with a Flask web UI for browsing and monitoring downloads.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published