I am trying to load files uploaded using Angular application to S3 using presigned URL but file gets corrupted after upload. It works using postman.
Lambda FastAPI function to handle the upload-
async def temp_upload_file_to_s3(email_id: str = Form(...),file: List[UploadFile] = File(...),db: connection = Depends(get_db_connection)): s3_client = boto3.client('s3') for file1 in file: key = 'raw/'+ file1.filename presigned_url = await generate_presigned_url(key, 'put_object') print(presigned_url) response = requests.put(presigned_url, data=await file1.read()) print(response) return {"status": "success", "message": "Files uploaded to S3"}