NAME
Dancer::Core::Request::Upload - Class representing file upload requests
VERSION
version 2.0000_01
DESCRIPTION
This class implements a representation of file uploads for Dancer. These objects are accessible within route handlers via the request->uploads keyword. See Dancer::Request for details.
ATTRIBUTES
filename
Filename as sent by client. optional. May not be undef.
tempname
The name of the temporary file the data has been saved to. Optional. May not be undef.
headers
A hash ref of the headers associated with this upload. optional. is read-write and a HashRef.
size
The size of the upload, in bytes. Optional.
METHODS
my $filename=$upload->filename;
Returns the filename (full path) as sent by the client.
my $tempname=$upload->tempname;
Returns the name of the temporary file the data has been saved to.
For example, in directory /tmp, and given a random name, with no file extension.
my $href=$upload->headers;
Returns a hashRef of the headers associated with this upload.
my $fh=$upload->file_handle;
Returns a read-only file handle on the temporary file.
$upload->copy_to('/path/to/target')
Copies the temporary file using File::Copy. Returns true for success, false for failure.
$upload->link_to('/path/to/target');
Creates a hard link to the temporary file. Returns true for success, false for failure.
my $content=$upload->content;
Returns a scalar containing the contents of the temporary file.
my $basename=$upload->basename;
Returns basename for "filename".
$upload->type
Returns the Content-Type of this upload.
SEE ALSO
AUTHOR
Dancer Core Developers
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Alexis Sukrieh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.