Skip to content

Commit 8e198e2

Browse files
author
Brian Luk
committed
Use upload_large when file size is larger than 20MB
1 parent 575d903 commit 8e198e2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cloudinary_cli/utils/api_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ def upload_file(file_path, options, uploaded=None, skipped=None):
4242
verbose = logger.getEffectiveLevel() < logging.INFO
4343

4444
try:
45-
result = uploader.upload(file_path, **options)
45+
size = path.getsize(file_path)
46+
upload_func = uploader.upload
47+
if size > 20000000:
48+
upload_func = uploader.upload_large
49+
result = upload_func(file_path, **options)
4650
logger.info(style(f"Successfully uploaded {file_path} as {result['public_id']}", fg="green"))
4751
if verbose:
4852
print_json(result)

0 commit comments

Comments
 (0)