The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MVC::Neaf::Upload - File upload object for Not Even A Framework

METHODS

Generally, this class isn't used directly; instead, it's returned by an MVC::Neaf::Request object.

new(%options)

%options may include:

  • id (required) - the form id by which upload is known.

  • tempfile - filfe where upload is stored.

  • handle - file handle opened for readin. One of these is required.

  • filename - user-supplied filename. Don't trust this.

id()

Return upload id.

filename()

Get user-supplied file name. Don't trust this value.

size()

Calculate file size.

CAVEAT May return 0 if file is a pipe.

handle()

Return file handle, opening temp file if needed.

content()

Return file content (aka slurp), caching it in memory.

CAVEAT May eat up a lot of memory. Be careful...

NOTE This breaks file current position, resetting it to the beginning.

rewind()

Reset the file to the beginning. Will fail silently on pipes.

Returns self.