Class Poco::Net::FilePartSource
Author: Applied Informatics Software Engineering GmbH and Contributors

# Poco::Net

# class FilePartSource

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

## Description

An implementation of PartSource for plain files.

## Inheritance

Direct Base Classes: PartSource

All Base Classes: PartSource

## Member Summary

Member Functions: filename, getContentLength, stream

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

## Constructors

### FilePartSource

FilePartSource(
const std::string & path
);

Creates the FilePartSource for the given path.

The MIME type is set to application/octet-stream.

Throws an OpenFileException if the file cannot be opened.

### FilePartSource

FilePartSource(
const std::string & path,
const std::string & mediaType
);

Creates the FilePartSource for the given path and MIME type.

Throws an OpenFileException if the file cannot be opened.

### FilePartSource

FilePartSource(
const std::string & path,
const std::string & filename,
const std::string & mediaType
);

Creates the FilePartSource for the given path and MIME type. The given filename is used as part filename (see filename()) only.

Throws an OpenFileException if the file cannot be opened.

## Destructor

### ~FilePartSource

~FilePartSource();

Destroys the FilePartSource.

## Member Functions

### filename

const std::string & filename() const;

Returns the filename portion of the path.

See also: Poco::Net::PartSource::filename()

### getContentLength

std::streamsize getContentLength() const;

Returns the file size.

See also: Poco::Net::PartSource::getContentLength()

### stream

std::istream & stream();

Returns a file input stream for the given file.

See also: Poco::Net::PartSource::stream()