NOTE: For Version 3 of the AWS SDK for PHP, please see the V3 User Guide and V3 API Reference.

# Class UploadBodyListener

Prepares the body parameter of a command such that the parameter is more flexible (e.g. accepts file handles) with the value it accepts but converts it to the correct format for the command. Also looks for a "Filename" parameter.

  Aws\Common\Client\UploadBodyListener implements Symfony\Component\EventDispatcher\EventSubscriberInterface

Namespace: Aws\Common\Client
Located at Aws/Common/Client/UploadBodyListener.php

## Methods summary

- `public` `__construct ( array $commands, string $bodyParameter = 'Body', string $sourceParameter = 'SourceFile' )`
- `public static` `getSubscribedEvents ( )`
- `public` `onCommandBeforePrepare ( Guzzle\Common\Event $event )`

  Converts filenames and file handles into EntityBody objects before the command is validated

## Methods detail

# `public`
`__construct( array $commands, string $bodyParameter = 'Body', string $sourceParameter = 'SourceFile' )`

#### Parameters

$commands
  `array`
  $commands The commands to modify
$bodyParameter
  `string`
  $bodyParameter The key for the body parameter
$sourceParameter
  `string`
  $sourceParameter The key for the source file parameter

# `public static`
`getSubscribedEvents( )`
# `public`
`onCommandBeforePrepare( `Guzzle\Common\Event` $event )`

Converts filenames and file handles into EntityBody objects before the command is validated

#### Parameters

$event
  ``Guzzle\Common\Event``
  $event Event emitted

#### Throws

``Aws\Common\Exception\InvalidArgumentException``

### Magic methods summary

## Properties summary

`protected array` | $commands | # The names of the commands of which to modify the body parameter
`protected string` | $bodyParameter | # The key for the upload body parameter
`protected string` | $sourceParameter | # The key for the source file parameter