PhoenixKitWeb.FileController (phoenix_kit v1.6.15)
View SourceFile serving controller with signed URL support.
Handles secure file retrieval with token-based authentication and cache headers.
Summary
Functions
Get file information without serving the file.
Serve a file variant by ID with signed URL token.
Functions
Get file information without serving the file.
Request
GET /api/files/:file_id/infoResponse
Success (200):
{
"file_id": "uuid",
"original_filename": "photo.jpg",
"mime_type": "image/jpeg",
"file_type": "image",
"size": 1234567,
"status": "active",
"variants": [
{
"variant_name": "original",
"mime_type": "image/jpeg",
"size": 1234567,
"width": 1920,
"height": 1080,
"url": "/file/uuid/original/token"
}
]
}
Serve a file variant by ID with signed URL token.
Request
GET /file/:file_id/:variant/:tokenParameters
file_id: UUID of the filevariant: Variant name (e.g., "original", "thumbnail", "medium")token: Signed token for authentication
Response
Success (200):
- File streamed to client with appropriate headers:
Cache-Control: public, max-age=31536000(1 year)ETag: "md5-hash"Content-Type: <mime-type>Content-Disposition: inline; filename="..."
Error (401):
"Invalid or expired token"Error (404):
"File or variant not found"