HTML::...::File(3pm)

πŸ“¦
version 2.07000 Β· 5 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

✨ HTML::FormFu::Constraint::File β€” the vibe ✨

okay so bestie, this is a page from the User Contributed Perl Documentation section, manual page HTML::...::File(3pm) πŸ’– (yes the name got abbreviated, that's just how the man page renders it, don't come for me). It's giving "tiny module, big opinions about your uploads". Let's get into it 🌸


🌈 NAME 🌈

HTML::FormFu::Constraint::File β€” the File Upload Constraint πŸ‘‘


πŸŽ€ VERSION πŸŽ€

version 2.07 β€” she's a specific girlie, no ambiguity ✨


πŸ’… DESCRIPTION πŸ’…

So the whole job here? Make sure the submitted value is a file upload. That's it. That's the gig. 🫢

And here's the little tea: you don't actually need this Constraint if you're using any of the File::* Constraints, because all of them already make the exact same check this one does. So like… this is the bare-bones version, and the File::* ones are the deluxe version. Periodt. πŸ’€


😭 LIMITATIONS 😭 (read this one, fr fr)

This can only verify that your CGI backend (CGI, Catalyst, CGI::Simple) thinks it was a file upload. That's the ceiling, bestie, that's as far as she goes. πŸ™ˆ

Now the messy part: if the user submits a filename that doesn't exist on their system, you will probably get a valid HTML::FormFu::Upload object β€” with a valid filehandle β€” but no Content-Length. And this Constraint? She would still look at that and go "yep, valid uploaded file πŸ’…" because that's literally all she checks.

So if what you actually want is to guarantee you get a file with content, don't rely on this one. Instead use HTML::FormFu::Constraint::File::Size with min set to 1. That's the move. πŸ‘‘

πŸ¦‹ SEE ALSO πŸ¦‹

  • She's a sub-class of, and inherits methods from HTML::FormFu::Constraint β€” so all that inherited goodness is yours πŸ’œ
  • HTML::FormFu β€” the mothership 🌟

πŸ“ AUTHOR πŸ“

Carl Franks, cfranks@cpan.org


πŸ“œ LICENSE πŸ“œ

This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. 🫢 (iconic, honestly)


🧚 AUTHOR (yes, again) 🧚

Carl Franks <cpan@fireartist.com>


This software is copyright (c) 2018 by Carl Franks.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. 🌈


and that's the whole page, bestie!! this cutie was documented by perl v5.28.1 on 2019-01-12 β€” so if you're reading this on a newer perl, just know she's an elder but she still ate πŸ’–βœ¨ no cap.

πŸ“¦ where this page comes from