Upload to S3 issue

Hello,
I am using PHPMaker version 2021.12 and I am trying to upload files to S3 bucket, I have registered the Amazon S3 Stream Wrapper in the Global Code server event with appropriate access key and secret, also I added amazonwebservices/aws-sdk-for-php in the composer packages also I enabled public access to the S3 bucket but I am getting error in the log file as below:
Slim Application Error Type: Exception Code: 0 Message: Folder does not exist: s3://xxxx/websites/eds/mcdonalds/PDFs/
Any hints please?

tamersherif wrote:

I added amazonwebservices/aws-sdk-for-php in the composer packages >

It is deprecated, you should use aws/aws-sdk-php, also see Server Events and Client Scripts → Server Events → Global Code → Example 2 in the help file.

I fixed this but I got a new error, however the S3 bucket permissions is public
Application Error Type: Exception Code: 0 Message: Cannot create folder: s3://xxx/websites/eds/mcdonalds/PDFs/temp__s5c7g9k9n5qjqmukfnd160a44j/documents/x_Document_PDF/

Make sure you have granted “WRITE” access.