Discussion:
[Mojolicious] Getting File Extension of Mojo::Upload Object
Viktor Nacht
2018-10-12 18:11:39 UTC
Permalink
Just wondering if I'm missing anything for getting the file extension of an
uploaded file before it's been moved or slurped. Right now my approach is
to create Mojo::File object about the filename from Mojo::Upload and
extract it from there. Is there a more direct method I'm unaware of?

Thanks!

V
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Dan Book
2018-10-12 18:18:40 UTC
Permalink
The original filename is available from $upload->filename, you can parse
the extension from that. Note that this filename can be literally anything
the browser sends, some may even send a full Windows file path for example,
or it's possible a client will not send a filename.

-Dan
Post by Viktor Nacht
Just wondering if I'm missing anything for getting the file extension of
an uploaded file before it's been moved or slurped. Right now my approach
is to create Mojo::File object about the filename from Mojo::Upload and
extract it from there. Is there a more direct method I'm unaware of?
Thanks!
V
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
Loading...