Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Jun 21, 2024
1 parent a435775 commit 1e2fd06
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions website/documentation/content/upload_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ def handle_upload(e: events.UploadEventArguments):


@doc.demo('Uploading large files', '''
Large file uploads may encounter issues due to the default file size parameter set within the underlying Starlette library.
To ensure smooth uploads of larger files, it's recommended to increase the `max_file_size` parameter in Starlette's `MultiPartParser` class from the default of `1024 * 1024` (1 Mb) to a higher limit that aligns with the expected file sizes.
This demo increases Starlette Multiparser's `max_file_size` to be kept in RAM to 5 Mb.
This change allows the system to handle larger files more efficiently by keeping them in RAM, thus avoiding the need to write data to temporary files on disk and preventing upload 'stuttering'.
Large file uploads may encounter issues due to the default file size parameter set within the underlying Starlette library.
To ensure smooth uploads of larger files, it is recommended to increase the `max_file_size` parameter in Starlette's `MultiPartParser` class from the default of `1024 * 1024` (1 MB) to a higher limit that aligns with the expected file sizes.
This demo increases Starlette Multiparser's `max_file_size` to be kept in RAM to 5 MB.
This change allows the system to handle larger files more efficiently by keeping them in RAM, thus avoiding the need to write data to temporary files on disk and preventing upload "stuttering".
However, be mindful of the potential impact on your server when allowing users to upload large files and retaining them in RAM.
''')
def uploading_large_files() -> None:
from starlette.formparsers import MultiPartParser

MultiPartParser.max_file_size = 1024 * 1024 * 5 # 5 Mb.
MultiPartParser.max_file_size = 1024 * 1024 * 5 # 5 MB

ui.upload(on_upload=lambda e: ui.notify(f'Uploaded {e.name}')).classes('max-w-full')

Expand Down

0 comments on commit 1e2fd06

Please sign in to comment.