Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DeepSpringAI/upload_files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Upload Service

A simple FastAPI service for uploading files and retrieving them via direct links.

Features

  • Upload files via POST endpoint
  • Get direct download links for uploaded files
  • Retrieve file metadata
  • Health check endpoint

API Endpoints

Upload File

POST /upload
Content-Type: multipart/form-data

# Returns:
{
  "filename": "document.pdf",
  "original_filename": "document.pdf",
  "download_url": "/document.pdf",
  "size": 12345
}

Download File (Direct Access)

GET /{filename}
# Example: GET /document.pdf
# Returns the file for download/viewing
# Access directly via: domain-name/document.pdf

Get File Info

GET /file/{filename}/info
# Example: GET /file/document.pdf/info
# Returns file metadata without downloading

Health Check

GET /health
# Returns: {"status": "healthy"}

Docker Usage

Build the image

docker build -t upload-files-service .

Run the container

docker run -p 8000:8000 -v $(pwd)/uploads:/app/uploads upload-files-service

Access the API

Example Usage

Upload a file

curl -X POST "http://localhost:8000/upload" \
  -F "file=@/path/to/your/file.pdf"

Download a file (direct access)

# After uploading "document.pdf", access it directly:
curl -O "http://localhost:8000/document.pdf"

# Or open in browser:
# http://localhost:8000/document.pdf

Get file info

curl "http://localhost:8000/file/document.pdf/info"

Notes

  • Files are stored in /app/uploads inside the container
  • File metadata is stored in memory (use a database for production)
  • The service uses UUIDs for file identification

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published