Poco::Net

class FilePartStore

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

Description

An implementation of PartSource for persisting parts (usually email attachment files) to the file system.

Inheritance

Direct Base Classes: PartStore

All Base Classes: PartSource, PartStore

Member Summary

Member Functions: filename, path, stream

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

Constructors

FilePartStore

FilePartStore(
    const std::string & content,
    const std::string & mediaType,
    const std::string & filename = ""
);

Creates the FilePartStore for the given MIME type. For security purposes, attachment filename is NOT used to save file to the file system. A unique temporary file name is used to persist the file. The given filename parameter is the message part (attachment) filename (see filename()) only.

Throws an exception if the file cannot be opened.

Destructor

~FilePartStore virtual

~FilePartStore();

Destroys the FilePartStore.

Member Functions

filename virtual

const std::string & filename() const;

Returns the filename portion of the path. This is the name under which the file is known to the user of this class (typically, MailMessage class). The real name of the file as saved to the filesystem can be obtained by calling path() member function.

path

const std::string & path() const;

Returns the full path to the file as saved to the file system. For security reasons, file is not saved under the real file name (as specified by the user).

stream virtual

std::istream & stream();

Returns a file input stream for the given file.