I am trying to upload multiple images in s3 from react application using aws api gateway. I have tried below approach:
- Setup api gateway which target to lambda function.
-
lambda function code: -
import json import boto3 def lambda_handler(event, context): print(event) s3 = boto3.client('s3', region_name='us-east-1') bucket_name = 'testimagesbucketupload' URL = s3.generate_presigned_post( Bucket= bucket_name, Key="${filename}", # Conditions=[ # ["starts-with", "$success_action_redirect", ""], # ["eq", "$userid", "test"], # ], ExpiresIn=3600) data = {"url": URL['url'], "fields": URL['fields']} print(type(data)) # print(data) return data
Using above code i am able to upload single image from web and postman both but now i want to upload multiple image using this url and also want to retrieve image for preview..
If any one worked please help me
Thanks in advance..
I tried presigned_post and presigned-url for achieve this but still i am not able to achieve this