# Poco::Net

# class PartSource

Library: Net
Package: Messages
Header: Poco/Net/PartSource.h

## Description

This abstract class is used for adding parts or attachments to mail messages, as well as for uploading files as part of a HTML form.

## Inheritance

Known Derived Classes: FilePartSource, MultipartSource, PartStore, FilePartStore, StringPartSource

## Member Summary

Member Functions: filename, getContentLength, headers, mediaType, stream

## Constructors

### PartSource

PartSource();

Creates the PartSource, using the application/octet-stream MIME type.

### PartSource

PartSource(
const std::string & mediaType
);

Creates the PartSource, using the given MIME type.

## Destructor

### ~PartSource

virtual ~PartSource();

Destroys the PartSource.

## Member Functions

### filename

virtual const std::string & filename() const;

Returns the filename for the part or attachment.

May be overridden by subclasses. The default implementation returns an empty string.

### getContentLength

virtual std::streamsize getContentLength() const;

Returns the content length for this part which may be UNKNOWN_CONTENT_LENGTH if not available.

### headers

MessageHeader & headers();

Returns a MessageHeader containing additional header fields for the part.

### headers

const MessageHeader & headers() const;

Returns a MessageHeader containing additional header fields for the part.

### mediaType

const std::string & mediaType() const;

Returns the MIME media type for this part or attachment.

### stream

virtual std::istream & stream() = 0;

Returns an input stream for reading the part data.

Subclasses must override this method.

## Variables

### UNKNOWN_CONTENT_LENGTH

static const int UNKNOWN_CONTENT_LENGTH;