10 lines
402 B
Python
10 lines
402 B
Python
from flask import current_app
|
|
|
|
def upload_file(rb_file, file_name):
|
|
cos_client = current_app.extensions["cos_client"]
|
|
cos_client.put_object(
|
|
Bucket=current_app.config["TENCENT_COS"]["bucket"],
|
|
Body=rb_file,
|
|
Key=file_name,
|
|
)
|
|
return f"https://{current_app.config['TENCENT_COS']['bucket']}.cos.{current_app.config['TENCENT_COS']['region']}.myqcloud.com/{file_name}" |