| 1 | package Mojo::Upload; | ||||||||||
| 2 | 29 | ▶ | use Mojo::Base -base; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 29 | has [qw(asset filename headers name)]; | |||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | sub move_to { $_[0]->asset->move_to($_[1]) and return $_[0] } | ||||||||
|
Subroutine
move_to: called CC=2 SCAR=7.6
Pod
documented
Branch: 1 branch
| |||||||||||
| 7 | |||||||||||
| 8 | 5 | ▶ | sub size { shift->asset->size } | ||||||||
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 9 | 9 | ▶ | sub slurp { shift->asset->slurp } | ||||||||
|
Subroutine
slurp: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 10 | |||||||||||
| 11 | 29 | 1; | |||||||||
| 12 | |||||||||||
| 13 | =encoding utf8 | ||||||||||
| 14 | |||||||||||
| 15 | =head1 NAME | ||||||||||
| 16 | |||||||||||
| 17 | Mojo::Upload - Upload | ||||||||||
| 18 | |||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||
| 20 | |||||||||||
| 21 | use Mojo::Upload; | ||||||||||
| 22 | |||||||||||
| 23 | my $upload = Mojo::Upload->new; | ||||||||||
| 24 | say $upload->filename; | ||||||||||
| 25 | $upload->move_to('/home/sri/foo.txt'); | ||||||||||
| 26 | |||||||||||
| 27 | =head1 DESCRIPTION | ||||||||||
| 28 | |||||||||||
| 29 | L<Mojo::Upload> is a container for uploaded files. | ||||||||||
| 30 | |||||||||||
| 31 | =head1 ATTRIBUTES | ||||||||||
| 32 | |||||||||||
| 33 | L<Mojo::Upload> implements the following attributes. | ||||||||||
| 34 | |||||||||||
| 35 | =head2 asset | ||||||||||
| 36 | |||||||||||
| 37 | my $asset = $upload->asset; | ||||||||||
| 38 | $upload = $upload->asset(Mojo::Asset::File->new); | ||||||||||
| 39 | |||||||||||
| 40 | Asset containing the uploaded data, usually a L<Mojo::Asset::File> or L<Mojo::Asset::Memory> object. | ||||||||||
| 41 | |||||||||||
| 42 | =head2 filename | ||||||||||
| 43 | |||||||||||
| 44 | my $filename = $upload->filename; | ||||||||||
| 45 | $upload = $upload->filename('foo.txt'); | ||||||||||
| 46 | |||||||||||
| 47 | Name of the uploaded file. | ||||||||||
| 48 | |||||||||||
| 49 | =head2 headers | ||||||||||
| 50 | |||||||||||
| 51 | my $headers = $upload->headers; | ||||||||||
| 52 | $upload = $upload->headers(Mojo::Headers->new); | ||||||||||
| 53 | |||||||||||
| 54 | Headers for upload, usually a L<Mojo::Headers> object. | ||||||||||
| 55 | |||||||||||
| 56 | =head2 name | ||||||||||
| 57 | |||||||||||
| 58 | my $name = $upload->name; | ||||||||||
| 59 | $upload = $upload->name('foo'); | ||||||||||
| 60 | |||||||||||
| 61 | Name of the upload. | ||||||||||
| 62 | |||||||||||
| 63 | =head1 METHODS | ||||||||||
| 64 | |||||||||||
| 65 | L<Mojo::Upload> inherits all methods from L<Mojo::Base> and implements the following new ones. | ||||||||||
| 66 | |||||||||||
| 67 | =head2 move_to | ||||||||||
| 68 | |||||||||||
| 69 | $upload = $upload->move_to('/home/sri/foo.txt'); | ||||||||||
| 70 | |||||||||||
| 71 | Move uploaded data into a specific file. | ||||||||||
| 72 | |||||||||||
| 73 | =head2 size | ||||||||||
| 74 | |||||||||||
| 75 | my $size = $upload->size; | ||||||||||
| 76 | |||||||||||
| 77 | Size of uploaded data in bytes. | ||||||||||
| 78 | |||||||||||
| 79 | =head2 slurp | ||||||||||
| 80 | |||||||||||
| 81 | my $bytes = $upload->slurp; | ||||||||||
| 82 | |||||||||||
| 83 | Read all uploaded data at once. | ||||||||||
| 84 | |||||||||||
| 85 | =head1 SEE ALSO | ||||||||||
| 86 | |||||||||||
| 87 | L<Mojolicious>, L<Mojolicious::Guides>, L<https://mojolicious.org>. | ||||||||||
| 88 | |||||||||||
| 89 | =cut | ||||||||||