Upload File Content to Amazon S3

Use the code snippet below to create an LWC component to upload the file and add it to a Lightning page.

Here, uploadParams is the output from the getS3UploadUrl function in the ConnectApiHelper Apex class. The LWC uses the URLs from the response of Initialize Upload to upload the files to the Amazon S3 bucket.

For large files, the LWC splits the file into chunks of 100 MB and uploads them.

Capture the E-tag returned by Amazon S3 for every successfully uploaded chunk.