It says that the uploads are returned as Mojo::Upload objects. These
objects have an 'asset' attribute which returns the Mojo::Asset::File or
Mojo::Asset::Memory, both of which have a 'slurp' method you can use to
read the contents into memory, and other methods. It's usually a bad idea
to access the private hash attributes of mojo objects.

On Fri, Apr 7, 2017 at 4:12 PM, iaw4 <[email protected]> wrote:

>
> dear M wizards:
>
> the example in http://mojolicious.org/perldoc/Mojolicious/Guides/
> Tutorial#File-uploads is great, except that it does not show how to get
> the uploaded file contents.  may I suggest adding it?
>
> the good news is that $uploadfile->asset->{content} seems to have the
> content.  the bad news is that this is not the case if the uploaded file is
> of certain mime types, such as 'png'.
>
> what is the recommended way to get all the uploaded (binary) content into
> a perl string?  (I sometimes want to write to a file, which may be faster
> with a move; sometimes not.)
>
> sincerely,
>
> /iaw
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to