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 - file where upload is stored.
handle - file handle opened for readin. One of these is required.
filename - user-supplied filename. Don't trust this.
utf8 - if set, all data read from the file will be utf8-decoded.
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.