Update validate_upload error message to use database max_upload_size_mb setting

- Error message now shows correct maximum file size from database setting
- Consistent with other validation functions using the same setting
parent c169a6f7
...@@ -73,8 +73,11 @@ class FileUploadHandler: ...@@ -73,8 +73,11 @@ class FileUploadHandler:
file.seek(0) file.seek(0)
if not validate_file_size(file_size): if not validate_file_size(file_size):
max_size_mb = current_app.config.get('MAX_CONTENT_LENGTH', 5 * 1024 * 1024 * 1024) // (1024 * 1024) file_size_mb = file_size // (1024*1024)
return False, f"File too large. Maximum size: {max_size_mb}MB" # Get max upload size from database settings (in MB)
from app.models import SystemSettings
max_upload_size_mb = SystemSettings.get_setting('max_upload_size_mb', 2048) # Default 2GB
return False, f"File too large ({file_size_mb}MB). Maximum size: {max_upload_size_mb}MB"
return True, None return True, None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment