This commit is contained in:
Philip Cheung 2024-10-08 01:20:44 +08:00
parent b1a21ffe16
commit ca99f9f1fb
1 changed files with 1 additions and 5 deletions

View File

@ -194,8 +194,7 @@ def validate_file_size_type(file: IO):
# return f'{static}/{folderName}/{picture_name}' # return f'{static}/{folderName}/{picture_name}'
def upload_file(file_name, bucket_name, object_name=None):
async def upload_file(file_name, bucket_name, object_name=None):
ConnectionUrl = f"https://{settings.AccountID}.r2.cloudflarestorage.com/images" ConnectionUrl = f"https://{settings.AccountID}.r2.cloudflarestorage.com/images"
r2 = boto3.client( r2 = boto3.client(
"s3", "s3",
@ -215,9 +214,6 @@ async def upload_file(file_name, bucket_name, object_name=None):
return True return True
async def save_picture(file, folder_name: str = "", file_name: str = None): async def save_picture(file, folder_name: str = "", file_name: str = None):
import io
randon_uid = str(uuid4()) randon_uid = str(uuid4())
_, f_ext = os.path.splitext(file.filename) _, f_ext = os.path.splitext(file.filename)