I'm uploading pdf's to s3 bucket right now all present on base directory ,using this code
def connect_S3(self):
return boto3.client('s3',
region_name=AWS_REGION,
aws_access_key_id=AWS_ACCESS_KEY_ID,
aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
s3_client=return of connect_S3()
def upload_to_s3(self, s3_client, img_path, img_name):
while True:
try:
s3_client.upload_file(img_path, AWS_S3_BUCKET, img_name)
break
except Exception as e:
print(e)
but this code uploads my files to base directory is there any way i can create a Folder and upload every file into a particular folder