'how can i upload a file to specific folder in AWS s3 bucket using koltin

i want to upload the magneto.json file in specific folder magnetometer in AWS s3 bucket here is the code

Amplify.Storage.uploadFile(
            "Magneto.json",
            exampleFile, 
            { result: StorageUploadFileResult ->
                Log.i(
                    "MyAmplifyApp",
                    "Successfully uploaded: " + result.key
                )
                Toast.makeText(this, "File has Successfully Uploaded:" , Toast.LENGTH_SHORT).show()
            }
        ) { storageFailure: StorageException? ->
            Log.e(
                "MyAmplifyApp",
                "Upload failed",
                storageFailure
            )
            Toast.makeText(this, "Upload failed", Toast.LENGTH_SHORT).show()
        }
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source