Plack::...:Upload(3)
π Plack::Request::Upload π
okay so bestie, welcome to Plack::Request::Upload β the module that handles file upload requests. yes, THE file upload module, the one your form goes through when someone drops a pic into your webapp. no cap, it's giving backend royalty π
this lil page is from the User Contributed Perl Documentation, so it's iykyk territory π«Ά
β¨ SYNOPSIS β¨
so like, here's the vibe in code form, mkay:
# $req is Plack::Request
my $upload = $req->uploads->{field};
$upload->size;
$upload->path;
$upload->content_type;
$upload->basename;
$req is a Plack::Request, and you pull your upload out of $req->uploads->{field} like it's a lil gift π then you can poke at it with all the methods below. slay.
πΈ METHODS πΈ
sizeβ returns the size of the Uploaded file. that's it, that's the method. how big is your file, bestie? this tells you πpathβ returns the path to the temporary file where the uploaded file is saved. so like, the file doesn't live where the client said it lives, it lives in a temp spot, and this is where you find it π¦content_typeβ returns the content type of the uploaded file. the MIME type, the vibe check of the file, what kind of thing it is β¨filenameβ returns the original filename in the client. as in, whatever the client claimed the name was, untouched, no sanitising, raw as it gets πbasenameβ returns basename for"filename". and here's the tea π΅ characters other than word characters,"."and"-"get replaced with"_", and a name that would come out empty,"."or".."gets returned as"_".
β οΈ ok so listen, this is important: the returned value is still client-supplied. you should make sure it doesn't overwrite existing files before using it as a file name. fr fr, do NOT just trust it. it's giving "user input, handle with care" ππ
π AUTHORS π
- Kazuhiro Osawa
- Tatsuhiko Miyagawa
absolute icons, both of them. we stan π«Ά
π SEE ALSO π
Plack::RequestCatalyst::Request::Upload
go read those next bestie, they're in the same friend group π
and that's the whole page!! this was perl v5.42.3, dated 2026-10-18, and it's the Plack::...:Upload(3) manpage, mwah π go forth and handle those uploads responsibly, k? β¨ππ¦
π¦ where this page comes from
- fedora 43: perl-Plack 1.0055-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-Plack 1.0055-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