# 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, StringPartSource

## Member Summary

Member Functions: filename, 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();

Returns the filename for the part or attachment.

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

### 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.