Provided by: libdancer2-perl_0.400001+dfsg-1_all
NAME
Dancer2::Core::Request::Upload - Class representing file upload requests
VERSION
version 0.400001
DESCRIPTION
This class implements a representation of file uploads for Dancer2. These objects are accessible within route handlers via the request->uploads keyword. See Dancer2::Core::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
Dancer2
AUTHOR
Dancer Core Developers
COPYRIGHT AND LICENSE
This software is copyright (c) 2023 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.