Commit | Line | Data |
7adfd53f |
1 | package Reaction::UI::ViewPort::Field::File; |
2 | |
3 | use Reaction::Class; |
4 | use Reaction::Types::File; |
5 | |
6 | class File is 'Reaction::UI::ViewPort::Field', which { |
7 | |
8 | has '+value' => (isa => 'File', required => 0); |
6ab43711 |
9 | |
10 | #has '+layout' => (default => 'file'); |
11 | |
5db4d87c |
12 | override value_string => sub { '' }; |
13 | |
7adfd53f |
14 | override apply_our_events => sub { |
15 | my ($self, $ctx, $events) = @_; |
16 | my $value_key = join(':', $self->location, 'value'); |
17 | if (my $upload = $ctx->req->upload($value_key)) { |
18 | local $events->{$value_key} = $upload; |
19 | return super(); |
20 | } else { |
21 | return super(); |
22 | } |
23 | }; |
24 | |
25 | }; |
26 | |
27 | 1; |
28 | |
29 | =head1 NAME |
30 | |
31 | Reaction::UI::ViewPort::Field::File |
32 | |
33 | =head1 DESCRIPTION |
34 | |
35 | =head1 SEE ALSO |
36 | |
37 | =head2 L<Reaction::UI::ViewPort::Field> |
38 | |
39 | =head1 AUTHORS |
40 | |
41 | See L<Reaction::Class> for authors. |
42 | |
43 | =head1 LICENSE |
44 | |
45 | See L<Reaction::Class> for the license. |
46 | |
47 | =cut |