Newer Older
100 lines | 1.747kb
copy gitweblite soruce code
root authored on 2012-11-23
1
package Mojo::Upload;
2
use Mojo::Base -base;
3

            
4
use Mojo::Asset::File;
5
use Mojo::Headers;
6

            
7
has asset => sub { Mojo::Asset::File->new };
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
8
has [qw(filename name)];
copy gitweblite soruce code
root authored on 2012-11-23
9
has headers => sub { Mojo::Headers->new };
10

            
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
11
sub move_to {
12
  my $self = shift;
13
  $self->asset->move_to(@_);
14
  return $self;
15
}
16

            
17
sub size  { shift->asset->size }
18
sub slurp { shift->asset->slurp }
copy gitweblite soruce code
root authored on 2012-11-23
19

            
20
1;
21

            
update Mojolicious to 4.57
Yuki Kimoto authored on 2013-12-02
22
=encoding utf8
23

            
copy gitweblite soruce code
root authored on 2012-11-23
24
=head1 NAME
25

            
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
26
Mojo::Upload - Upload
copy gitweblite soruce code
root authored on 2012-11-23
27

            
28
=head1 SYNOPSIS
29

            
30
  use Mojo::Upload;
31

            
32
  my $upload = Mojo::Upload->new;
33
  say $upload->filename;
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
34
  $upload->move_to('/home/sri/foo.txt');
copy gitweblite soruce code
root authored on 2012-11-23
35

            
36
=head1 DESCRIPTION
37

            
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
38
L<Mojo::Upload> is a container for uploaded files.
copy gitweblite soruce code
root authored on 2012-11-23
39

            
40
=head1 ATTRIBUTES
41

            
42
L<Mojo::Upload> implements the following attributes.
43

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
44
=head2 asset
copy gitweblite soruce code
root authored on 2012-11-23
45

            
46
  my $asset = $upload->asset;
47
  $upload   = $upload->asset(Mojo::Asset::File->new);
48

            
update Mojolicious 4.07
Yuki Kimoto authored on 2013-06-03
49
Asset containing the uploaded data, usually a L<Mojo::Asset::File> or
50
L<Mojo::Asset::Memory> object.
copy gitweblite soruce code
root authored on 2012-11-23
51

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
52
=head2 filename
copy gitweblite soruce code
root authored on 2012-11-23
53

            
54
  my $filename = $upload->filename;
55
  $upload      = $upload->filename('foo.txt');
56

            
57
Name of the uploaded file.
58

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
59
=head2 headers
copy gitweblite soruce code
root authored on 2012-11-23
60

            
61
  my $headers = $upload->headers;
62
  $upload     = $upload->headers(Mojo::Headers->new);
63

            
64
Headers for upload, defaults to a L<Mojo::Headers> object.
65

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
66
=head2 name
copy gitweblite soruce code
root authored on 2012-11-23
67

            
68
  my $name = $upload->name;
69
  $upload  = $upload->name('foo');
70

            
71
Name of the upload.
72

            
73
=head1 METHODS
74

            
75
L<Mojo::Upload> inherits all methods from L<Mojo::Base> and implements the
76
following new ones.
77

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
78
=head2 move_to
copy gitweblite soruce code
root authored on 2012-11-23
79

            
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
80
  $upload = $upload->move_to('/home/sri/foo.txt');
copy gitweblite soruce code
root authored on 2012-11-23
81

            
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
82
Move uploaded data into a specific file.
copy gitweblite soruce code
root authored on 2012-11-23
83

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
84
=head2 size
copy gitweblite soruce code
root authored on 2012-11-23
85

            
86
  my $size = $upload->size;
87

            
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
88
Size of uploaded data in bytes.
copy gitweblite soruce code
root authored on 2012-11-23
89

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
90
=head2 slurp
copy gitweblite soruce code
root authored on 2012-11-23
91

            
update Mojolicious and added...
Yuki Kimoto authored on 2013-03-20
92
  my $bytes = $upload->slurp;
copy gitweblite soruce code
root authored on 2012-11-23
93

            
upgraded Mojolicious to v3.7...
Yuki Kimoto authored on 2013-01-28
94
Read all uploaded data at once.
copy gitweblite soruce code
root authored on 2012-11-23
95

            
96
=head1 SEE ALSO
97

            
98
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
99

            
100
=cut