Dancer2...:Upload(3)
π Dancer2::Core::Request::Upload β the vibe check π
okay so bestie, welcome to Dancer2::Core::Request::Upload, part of the User Contributed Perl Documentation collection π this is where Dancer2 keeps the lil class that represents your file uploads, and honestly? it's giving tidy. it's giving organized. we're obsessed π
β¨ VERSION β¨
version 2.2.1 β yes queen, that's the one πΈ
π¦ DESCRIPTION π¦
so basically this class implements a whole representation of file uploads for Dancer2. like, every uploaded file gets its own lil object, and you can grab them inside your route handlers with the request->uploads keyword π«Ά
want the deets on how that works? go peek at Dancer2::Core::Request, it's all there. iykyk β
π ATTRIBUTES π
πΈ filename
the filename as sent by the client. it's optional. but heads up β it may not be undef π
π§ tempname
the name of the temporary file the data got saved to. optional too. and also may not be undef bestie, we don't do that here π
π headers
a hash ref of the headers that came along with this upload. optional. it is read-write and it's a HashRef β¨
π size
the size of the upload, in bytes. optional. that's it, that's the whole thing π
π₯ METHODS π₯
π my $filename=$upload->filename;
hands you back the filename (full path) as sent by the client. no cap π
π my $tempname=$upload->tempname;
hands you back 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. cute lil anonymous temp file energy π₯Ί
β my $href=$upload->headers;
hands you back a hashRef of the headers associated with this upload. slay π
π¦ my $fh=$upload->file_handle;
hands you back a read-only file handle on the temporary file. read-only means read-only bestie, don't try it π
π $upload->copy_to('/path/to/target')
copies the temporary file using File::Copy. returns true for success, false for failure. simple as π«Ά
π $upload->link_to('/path/to/target');
creates a hard link to the temporary file. returns true for success, false for failure. linky link π
πΈ my $content=$upload->content;
hands you back a scalar containing the contents of the temporary file. the whole thing, in one lil string π
π§ my $basename=$upload->basename;
hands you back the basename for "filename". like, just the name part, no directory drama β¨
π $upload->type
hands you back the Content-Type of this upload. main character metadata moment π
π« SEE ALSO π«
- Dancer2 β go read it, it's iconic
π AUTHOR π
Dancer Core Developers β absolute legends, every single one π
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2026 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. so like, go forth and remix bestie π«Ά
and that's the whole page! perl v5.42.3, dated 2026-09-20, from the Dancer2...:Upload(3) files π mwah, stan a well-documented upload class β¨ππ¦
π¦ where this page comes from
- fedora 44: perl-Dancer2 2.2.1-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms