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

# Class PostFile

POST file upload

  Guzzle\Http\Message\PostFile implements Guzzle\Http\Message\PostFileInterface

Namespace: Guzzle\Http\Message
Located at Guzzle/Http/Message/PostFile.php

## Methods summary

- `public` `__construct ( string $fieldName, string $filename, string $contentType = null, string $postname = null )`
- `public` `setFieldName ( string $name )`

  Set the name of the field

- `public` `getFieldName ( )`

  Get the name of the field

- `public` `setFilename ( string $filename )`

  Set the path to the file

- `public` `setPostname ( string $postname )`

  Set the post name of the file

- `public` `getFilename ( )`

  Get the full path to the file

- `public` `getPostname ( )`

  Get the post name of the file

- `public` `setContentType ( string $type )`

  Set the Content-Type of the file

- `public` `getContentType ( )`

  Get the Content-Type of the file

- `public` `getCurlValue ( )`

  Get a cURL ready string or CurlFile object for the upload

- `protected` `guessContentType ( )`

  Determine the Content-Type of the file

## Methods detail

# `public`
`__construct( string $fieldName, string $filename, string $contentType = null, string $postname = null )`

#### Parameters

$fieldName
  `string`
  $fieldName Name of the field
$filename
  `string`
  $filename Local path to the file
$contentType
  `string`
  $postname Remote post file name
$postname
  `string`
  $contentType Content-Type of the upload

# `public `Guzzle\Http\Message\PostFile``
`setFieldName( string $name )`

Set the name of the field

#### Parameters

$name
  `string`
  $name Field name

#### Returns

``Guzzle\Http\Message\PostFile``

#### Implementation of

`Guzzle\Http\Message\PostFileInterface::setFieldName()`
# `public string`
`getFieldName( )`

Get the name of the field

#### Returns

`string`

#### Implementation of

`Guzzle\Http\Message\PostFileInterface::getFieldName()`
# `public `Guzzle\Http\Message\PostFile``
`setFilename( string $filename )`

Set the path to the file

#### Parameters

$filename
  `string`
  $path Full path to the file

#### Returns

``Guzzle\Http\Message\PostFile``

#### Throws

``Guzzle\Common\Exception\InvalidArgumentException``
if the file cannot be read

#### Implementation of

`Guzzle\Http\Message\PostFileInterface::setFilename()`
# `public `Guzzle\Http\Message\PostFile``
`setPostname( string $postname )`

Set the post name of the file

#### Parameters

$postname
  `string`
  $name The new name of the file

#### Returns

``Guzzle\Http\Message\PostFile``

#### Implementation of

`Guzzle\Http\Message\PostFileInterface::setPostname()`
# `public string`
`getFilename( )`

Get the full path to the file

#### Returns

`string`

#### Implementation of

`Guzzle\Http\Message\PostFileInterface::getFilename()`
# `public string`
`getPostname( )`

Get the post name of the file

#### Returns

`string`

#### Implementation of

`Guzzle\Http\Message\PostFileInterface::getPostname()`
# `public `Guzzle\Http\Message\PostFile``
`setContentType( string $type )`

Set the Content-Type of the file

#### Parameters

$type
  `string`
  $type Content type

#### Returns

``Guzzle\Http\Message\PostFile``

#### Implementation of

`Guzzle\Http\Message\PostFileInterface::setContentType()`
# `public string`
`getContentType( )`

Get the Content-Type of the file

#### Returns

`string`

#### Implementation of

`Guzzle\Http\Message\PostFileInterface::getContentType()`
# `public string`
`getCurlValue( )`

Get a cURL ready string or CurlFile object for the upload

#### Returns

`string`

#### Implementation of

`Guzzle\Http\Message\PostFileInterface::getCurlValue()`
# `protected`
`guessContentType( )`

Determine the Content-Type of the file

### Magic methods summary

## Properties summary

`protected mixed` | $fieldName | #
`protected mixed` | $contentType | #
`protected mixed` | $filename | #
`protected mixed` | $postname | #