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 🫢

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 πŸ‘‘


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