CPPSERV


Home Projects Jobs Clientele Contact
CPPSERV Documentation Download TODO Mailing lists Bug tracker News RSS Feed Browse source

container::UploadedFileImpl Class Reference

#include <UploadedFileImpl.h>

Inheritance diagram for container::UploadedFileImpl:
Collaboration diagram for container::UploadedFileImpl:

List of all members.


Public Member Functions

 UploadedFileImpl (const std::string &, bool, const std::string &, const std::string &)
 ~UploadedFileImpl ()
virtual bool isEmpty () const
virtual const std::string & getName () const
virtual std::iostream & getStream () throw (servlet::IOError)
virtual const std::string & mimeType () const

Protected Member Functions

void killTmp ()
virtual void doMoveTo (const std::string &path) throw (servlet::IOError)

Private Attributes

std::string m_fpath
 Path to temporary file.
bool m_empty
 Set to true if no file data was supplied.
std::fstream m_stream
std::string m_mimeType
 MIME type of the file.
std::string m_name
 Name of the file, as supplied by browser.

Detailed Description

Implementation of uploaded file handler

Author:
Ilya A. Volynets-Evenbakh

Definition at line 35 of file UploadedFileImpl.h.


Constructor & Destructor Documentation

container::UploadedFileImpl::UploadedFileImpl ( const std::string &  path,
bool  empty,
const std::string &  mime,
const std::string &  name 
)

Definition at line 26 of file UploadedFileImpl.cpp.

container::UploadedFileImpl::~UploadedFileImpl (  ) 

Definition at line 39 of file UploadedFileImpl.cpp.

References killTmp(), servlet::UploadedFile::m_moved, and m_stream.

Here is the call graph for this function:


Member Function Documentation

void container::UploadedFileImpl::doMoveTo ( const std::string &  path  )  throw (servlet::IOError) [protected, virtual]

Parameters:
path Where to put saved file This function takes data from internal stream and puts into file named by path

Implements servlet::UploadedFile.

Definition at line 110 of file UploadedFileImpl.cpp.

const std::string & container::UploadedFileImpl::getName (  )  const [virtual]

Returns:
file name, as supplied by user agent. Note: this name bears no relationship to any names on server file system. Furthermore - using it for saving files on file system is a security risk.

Implements servlet::UploadedFile.

Definition at line 67 of file UploadedFileImpl.cpp.

References m_name.

std::iostream & container::UploadedFileImpl::getStream (  )  throw (servlet::IOError) [virtual]

returns stream refering to downloaded file. It may not nessesarily be file

Implements servlet::UploadedFile.

Definition at line 81 of file UploadedFileImpl.cpp.

References m_fpath, and m_stream.

bool container::UploadedFileImpl::isEmpty (  )  const [virtual]

Returns:
true if file was empty This could be i.e. if user chose not to upload a file, so user agent sent multi-part section, but no actual data

Implements servlet::UploadedFile.

Definition at line 55 of file UploadedFileImpl.cpp.

References m_empty.

void container::UploadedFileImpl::killTmp (  )  [protected]

Unlinks temporary file

Definition at line 99 of file UploadedFileImpl.cpp.

References m_fpath.

Referenced by ~UploadedFileImpl().

const std::string & container::UploadedFileImpl::mimeType (  )  const [virtual]

Implements servlet::UploadedFile.

Definition at line 71 of file UploadedFileImpl.cpp.

References m_mimeType.


Member Data Documentation

Set to true if no file data was supplied.

Definition at line 41 of file UploadedFileImpl.h.

Referenced by isEmpty().

std::string container::UploadedFileImpl::m_fpath [private]

Path to temporary file.

Definition at line 39 of file UploadedFileImpl.h.

Referenced by getStream(), and killTmp().

MIME type of the file.

Definition at line 46 of file UploadedFileImpl.h.

Referenced by mimeType().

std::string container::UploadedFileImpl::m_name [private]

Name of the file, as supplied by browser.

Definition at line 48 of file UploadedFileImpl.h.

Referenced by getName().

Reference to stream

Definition at line 44 of file UploadedFileImpl.h.

Referenced by getStream(), and ~UploadedFileImpl().


The documentation for this class was generated from the following files:

SourceForge.net Logo