NAME

ePortal::Attachment - File attachment for any object

SYNOPSIS

ePortal::Attachment is used for manipulating file attachments.

Database store

Database store is the only method to store big attachments since ePortal 4.1.

Every attachment is split into several chunks. The size of a chunk is a New chunk tables are created automatically when the size of current table reached 2Gb limit. This method guaranteed that any file of any size can be stored on any OS platform.

File store

File store is deprecated since ePortal 4.1

content_type

Content type of a file negotiation is based on Apache internals. During download a subrequest is made to discover a content_type to use. See mod_mime Apache module and mime.types file for details.

METHODS

download_href()

Returns HREF to download the attachment.

Optionsl parameters are passed to download.htm. Some useful

download => 1 force 'downloading' the file instead of open it in browser

upload()

Upload a file from client and store it. Returns true is upload was successful.

Throws ePortal::Exception::DataNotValid if upload is impossible.

  • r

    Apache::Request object

Make a link between the attachment and some ThePersistent object. Also mark the attachment as complete.

filestore_path()

Returns path to directory like

/$comproot/attachment/1/0

read_from_fh

Read the content of attachment from FH and create a number of chunks as needed

  • fh

    Filehandle to read from

get_first_chunk,get_next_chunk

Low level functions for content retrieval chunk by chunk.

Returns undef when no chunks to retrieve

$att->get_first_chunk;
while(my $buffer = $att->get_next_chunk) {
   # do comthing with $buffer
}

AUTHOR

Sergey Rusakov, <rusakov_sa@users.sourceforge.net>