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

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