Im using the AWS SDK for php to upload files to my S3 bucket. I've created a separate user using the IAM Manager and have given it Full access to S3. This is the code i've implemented (PHP7, apache2)

```
$bucket = 'bucketname';

$file_path = $_FILES['fileToUpload']['tmp_name'];
$key = basename($_FILES["fileToUpload"]["name"]);

try{
    //Create a S3Client
    $s3Client = new S3Client([
        'version'     => 'latest',
        'region'      => 'ap-south-1',
        'credentials' => [
            'key'    => 'my-key',
            'secret' => 'secret-key',
        ],
    ]);

    $result = $s3Client->putObject([
        'Bucket'     => $bucket,
        'Key'        => $key,
        'SourceFile' => $file_path,
        'ACL'    => 'public-read',
    ]);

    echo $result['ObjectURL'];
} catch (S3Exception $e) {
    echo $e->getMessage() . "\n";
}

```

On uploading the file i am getting the url back like so

<https://bucketname.s3.ap-south-1.amazonaws.com/image.png>
(Not real URL)

This is the xml response i get back

```
<Error>
    <Code>NoSuchKey</Code>
    <Message>The specified key does not exist.</Message>
    <Key>/image.png</Key>
    <RequestId>E131E328AF9CAF41</RequestId>
    <HostId>gOreLsZBX9V1Whq++BoJVZCKPS415r51IUXXs0zZeIoa16KaXBCzOYKFrYYRktJJBB8HnBSyDTM=</HostId>
</Error>

```

Any ideas?